|
|
|
@@ -4,9 +4,14 @@ import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.MallUserInfo; |
|
|
|
import com.iformall.domain.po.WxCUser; |
|
|
|
import com.iformall.domain.po.WxMerchant; |
|
|
|
import com.iformall.domain.po.base.BaseEntity; |
|
|
|
import com.iformall.domain.po.WxCreditHistory; |
|
|
|
import com.iformall.enums.EnumScoreType; |
|
|
|
import com.iformall.enums.EnumUserType; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.service.WxCreditHistoryService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
@@ -53,4 +58,37 @@ public class WxCreditHistoryController extends BaseController{ |
|
|
|
final PageInfo<WxCreditHistory> page = wxCreditHistoryService.listAsPage(wxCreditHistory, pageNum, pageSize); |
|
|
|
return new ResultData(page); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("新增接口") |
|
|
|
@PostMapping("add") |
|
|
|
public ResultData add(@RequestBody WxCreditHistory wxCreditHistory) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::add"); |
|
|
|
WxCUser wxCUser = getWxCUser(); |
|
|
|
if(wxCUser.getUserId() == null){ |
|
|
|
return new ResultData(ErrorCode.PHONE_NOT_FOUND,"用户未授权手机号"); |
|
|
|
} |
|
|
|
|
|
|
|
wxCreditHistory.setTenantId(wxCUser.getFinalTenantId()); |
|
|
|
wxCreditHistory.setOperatorId(wxCUser.getId()); |
|
|
|
wxCreditHistory.setOperatorType(EnumUserType.CUSER.getCode()); |
|
|
|
|
|
|
|
String desc = ""; |
|
|
|
if(wxCreditHistory.getCreditType().equals(EnumScoreType.SPEND_CREDIT.getCode())){ |
|
|
|
desc = "游戏奖励积分"; |
|
|
|
}else if(wxCreditHistory.getCreditType().equals(EnumScoreType.REDUCE_CREDIT.getCode())){ |
|
|
|
desc = "游戏消耗积分"; |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"未知操作"); |
|
|
|
} |
|
|
|
wxCreditHistory.setChangePurpose(desc); |
|
|
|
try { |
|
|
|
wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),getTenantInfo()) ; |
|
|
|
WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory); |
|
|
|
return new ResultData(Result.SUCCESS, "操作成功", credit); |
|
|
|
} catch (MallinkException e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
return new ResultData(e.getErrorCode(), e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |