100], [['consumer_type'], 'string', 'max' => 20], [['change_type'], 'string', 'max' => 12], [['desc', 'source_table', 'from_type'], 'string', 'max' => 255], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'out_trade_no' => '系统支付流水号', 'consumer_id' => '消费者ID', 'consumer_type' => '消费者类型[mall=商城,agent=代理商]', 'change_type' => '操作类型:add-增加,sub-减少', 'change_num' => '操作数量', 'current_num' => '当前数量', 'desc' => '变动说明', 'source_table' => '来源表', 'source_table_id' => '操作来源业务id', 'from_type' => '来源类型', 'status' => '状态,-1:失效,1:正常,2:冻结', 'created_at' => '添加时间戳', 'updated_at' => '更新时间戳', 'payment_type' => '支付类型', ]; } /** * @Author: ltm * @DateTime: 2022/3/3 0003 18:06 * @Copyright: copyright (c) 2021 广东七件事集团 * @param $data * @return string */ public static function setData($params) { try { if (!empty($params['id'])) { $model = self::findOne(['id' => $params['id']]); } else { $model = new self(); $model->loadDefaultValues(); } if (empty($model)) throw new Exception('查无此订单'); if (!$model->load($params, '') || !$model->save()) throw new Exception($model->getErrorMessage()); return $model; } catch (\Exception $e) { self::setStaticError($e->getMessage()); return false; } } }