| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- namespace addons\Happiness\common\models;
- use common\models\user\User;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_happiness_commission_log".
- *
- * @property int $id
- * @property int $user_id 用户ID
- * @property float $money 获得佣金
- * @property int $status
- * @property int $commission_status 状态:0 未结算 1 已结算 2 已到账 3 已取消
- * @property int $commission_type 佣金类型: 0 分享收益 1 锁定收益 2 推广收益 3 代理收益
- * @property int $mall_id
- * @property int $agent_id 来源代理user_id
- * @property string $order_no
- * @property int $order_id
- * @property int $remark
- * @property float $order_money 获得佣金
- * @property int $send_time 延迟发放时间
- * @property int $store_id
- * @property int $created_at
- * @property int $updated_at
- */
- class HappinessCommissionLog extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_addons_happiness_commission_log';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['user_id', 'status', 'commission_status', 'mall_id','agent_id','store_id', 'order_id', 'send_time', 'created_at', 'updated_at','send_time'], 'integer'],
- [['money','order_money'], 'number'],
- [['order_no','commission_type'], 'string', 'max' => 255],
- [['remark'], 'string'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'user_id' => 'User ID',
- 'money' => 'Money',
- 'status' => 'Status',
- 'store_id' => 'Store ID',
- 'commission_status' => 'Commission Status',
- 'commission_type' => 'Commission Type',
- 'mall_id' => 'Mall ID',
- 'agent_id' => 'Agent ID',
- 'order_no' => 'Order No',
- 'order_id' => 'Order ID',
- 'order_money' => 'Order Money',
- 'send_time' => 'Send Time',
- 'remark' => 'Remark',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- public function getUser()
- {
- return $this->hasOne(User::class, ['id' => 'user_id']);
- }
- public function getStore()
- {
- return $this->hasOne(HappinessStore::class, ['id' => 'store_id']);
- }
- public static function setData($params)
- {
- try {
- if (isset($params['id']) && !empty($params['id']))
- $model = self::findOne($params['id']);
- else {
- $model = new self();
- $model->loadDefaultValues();
- }
- if (!$model->load($params, '') || !$model->save()) {
- throw new \Exception($model->getErrorMessage());
- }
- return $model;
- } catch (\Exception $e) {
- self::$static_error = $e->getMessage();
- return false;
- }
- }
- }
|