// +---------------------------------------------------------------------- declare (strict_types = 1); namespace app\store\controller\members; use app\common\enum\member\Action; use app\common\enum\member\AuditStatus; use app\store\controller\Controller; use app\store\model\member\DeductionLimit as DeductionLimitModel; use app\store\model\member\MemberCardsAction as MemberCardsActionModel; /** * 金米粒抵扣限制管理 * Class Refund * @package app\store\controller\member */ class DeductionLimit extends Controller { /** * 详情 * @param int $id * @return array * @author: zjwhust * @Time: 2022/5/25 15:58 */ public function detail(){ $detail = DeductionLimitModel::where('id','>',0)->find(); return $this->renderSuccess(compact('detail')); } /** * 新增 * @return array * @author: zjwhust * @Time: 2022/5/25 16:56 */ public function add() { $model = new DeductionLimitModel; $postData = $this->postForm(); $postData['audit_user'] = $this->store['user']['real_name']?:''; $postData['audit_admin_id'] = $this->store['user']['store_user_id']?:''; if(!$model->add($postData)){ return $this->renderError($model->getError() ?: '新增失败'); } return $this->renderSuccess([], '新增成功'); } /** * 编辑 * @return array * @author: zjwhust * @Time: 2022/5/25 16:56 */ public function edit() { $postData = $this->postForm(); $model = DeductionLimitModel::where('id','>',0)->find(); $postData['audit_status'] = AuditStatus::AUDIT_WAIT; $postData['audit_user'] = $this->store['user']['real_name']?:''; $postData['audit_admin_id'] = $this->store['user']['store_user_id']?:''; if(!$model->edit($postData)){ return $this->renderError($model->getError() ?: '编辑失败'); } return $this->renderSuccess([], '编辑成功'); } /** * 审核 * @return array * @author: zjwhust * @Time: 2022/5/25 16:56 */ // public function audit() // { // $postData = $this->postForm(); // $model = DeductionLimitModel::find($postData['id']); // $postData['audit_user'] = $this->store['user']['real_name']?:''; // $postData['audit_admin_id'] = $this->store['user']['store_user_id']?:''; // if(!$model->audit($postData)){ // return $this->renderError($model->getError() ?: '审核失败'); // } // return $this->renderSuccess([], '审核成功'); // } }