model = new GoodsCouponModel(); $this->validate = new GoodsCouponValidate(); } /** * 列表 * @return \think\response\Json */ public function index() { $inputData = $this->request->param(); // //语言包 // if (isset($inputData['language_id']) && $inputData['language_id'] != '' && $inputData['language_id'] != 0) { // $this->focus['language_id'] = $inputData['language_id']; // } else { // return $this->msg(504,'语言包ID不正确,请检查!'); // } $data = [ // 'language_id'=>$inputData['language_id'], 'platform_id'=>$this->platformId ]; $result = $this->model->getLatest($data); $result = ['old_code'=>$result['new_code']]; return $this->msg(200,'获取列表成功',$result); } /** * 新增 * @return \think\response\Json */ public function create() { $inputData = $this->request->param(); $inputData['platform_id'] = $this->platformId; $inputData['new_code'] = htmlspecialchars_decode($inputData['new_code']); if (!$this->commonValidate(__FUNCTION__,$inputData)) { return $this->msg(-1,$this->validate->getError()); } $inputData['new_code'] = htmlspecialchars($inputData['new_code']); $result = $this->model->addData($inputData); if ($result) { return $this->msg(200,'新增成功'); } else { return $this->msg(504,'新增失败'); } } }