1000], ]; } public function attributeLabels() { return [ 'id' => 'ID', 'store_id' => 'Store ID', 'start_time' => '开始时间', 'end_time' => '结束时间', 'rule' => '规则说明', 'integral' => '单次扣减积分数量' ]; } public function save() { if (!$this->validate()) { return $this->errorResponse; } if ($this->integral <= 0) { return [ 'code' => 1, 'msg' => '参数错误:积分数量错误' ]; } $this->model->store_id = $this->store_id; $this->model->rule = $this->rule; $this->model->start_time = $this->start_time; $this->model->end_time = $this->end_time; $this->model->integral = intval($this->integral); if ($this->model->save()) { return [ 'code' => 0, 'msg' => '保存成功' ]; } else { return $this->getErrorResponse($this->model); } } }