| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- namespace addons\Store\common\models;
- use common\enums\StatusEnum;
- use common\models\user\User;
- use Yii;
- /**
- * This is the model class for table "{{%addons_store_boss_commission_log}}".
- *
- * @property int $id
- * @property int $mall_id 商城ID
- * @property int $user_id 用户ID
- * @property float $amounts 结算总金额,单位:元
- * @property float $commission 永久/额外佣金,单位:元
- * @property int $type 奖励类型:1永久分红,2额外分红,3股东奖励
- * @property int $compute_period 结算周期:1天,2周,3月
- * @property int $start_time 结算开始日期
- * @property int $end_time 结算开始日期
- * @property int|null $status 状态[-1:删除;0:禁用;1启用]
- * @property int $created_at
- * @property int $updated_at
- */
- class StoreBossCommissionLog extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_store_boss_commission_log}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'user_id', 'type', 'compute_period', 'start_time', 'end_time', 'status', 'created_at', 'updated_at'], 'integer'],
- [['amounts', 'commission'], 'number'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => '商城ID',
- 'user_id' => '用户ID',
- 'amounts' => '结算总金额,单位:元',
- 'commission' => '永久/额外佣金,单位:元',
- 'type' => '奖励类型:1永久分红,2额外分红,3股东奖励',
- 'compute_period' => '结算周期:1天,2周,3月',
- 'start_time' => '结算开始日期',
- 'end_time' => '结算开始日期',
- 'status' => '状态[-1:删除;0:禁用;1启用]',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- 'updated_at' => 'Updated At',
- 'store_id' => '门店ID',
- 'source' => '佣金订单来源',
- ];
- }
- public function getUser()
- {
- return $this->hasOne(User::class, ['id' => 'user_id'])->select('id,nickname,mobile,username,avatar_url');
- }
- /**
- * 获取分红
- * @Author: lun
- * @DateTime: 2021/11/6 0006 11:53
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @param array $cond
- * @param array $with
- * @param bool $is_array
- * @param string $select
- * @param string $order
- * @return array|\yii\db\ActiveRecord[]
- */
- public static function getBossCommissionLog(array $cond=[], array $with=[],bool $is_array=true,string $select='*',$order=""){
- $default_cond = [['<>','status',StatusEnum::DELETE]];
- $cond = array_merge($default_cond,$cond);
- $query = self::find()->select($select);
- self::paramPack(['where'=>$cond, 'with'=>$with],$query);
- isset($order) && $query->orderBy($order);
- $data = $query->asArray($is_array)->all();
- return $data;
- }
- }
|