11], [['amount','income'], 'number'], [['order_no'], 'string', 'max' => 100], [['e_coupon_name'], 'string'], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'store_id' => '门店id', 'user_id' => '会员id', 'clerk_id' => '核销员id', 'mobile' => '电话', 'order_no' => '订单编号', 'amount' => '核销金额', 'income' => '核销收益', 'status' => '状态[0禁用 1启用 -1删除]', 'created_at' => '创建时间', 'updated_at' => '修改时间', 'e_coupon_id' => '电子券id', 'e_coupon_name' => '电子券名称', 'clerk_user_id' => '核销员', 'user_e_coupon_id'=>'用户电子券id', 'clerk_admin_id' => '核销员(管理员)', 'proper_user_id' => '专有者', 'num' => '兑换数量', ]; } public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id']); } public function getStore() { return $this->hasOne(Store::class, ['id' => 'store_id']); } public static function setData(array $params) { $t = Yii::$app->db->beginTransaction(); try { $model = new self(); $model->loadDefaultValues(); if (!$model->load($params, '')) throw new \Exception($model->getErrorMessage()); if (!$model->save()) throw new \Exception($model->getErrorMessage()); $t->commit(); return $model; } catch (\Exception $e) { $t->rollBack(); self::$static_error = $e->getMessage(); return false; } } }