| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- namespace addons\CloudStock\common\models;
- use common\models\user\User;
- use Yii;
- use common\models\base\BaseActiveRecord;
- /**
- * This is the model class for table "{{%addons_cloud_stock_delay_log}}".
- *
- * @property int $id
- * @property int $mall_id 商城ID
- * @property int $user_id 用户ID
- * @property int $compute_type 结算方式, 0订单完成后,1订单支付后
- * @property string $wallet_type 资产类型
- * @property float $wallet_num 结算资产数量
- * @property int $day_num 延时天数
- * @property string|null $wallet_desc 资产变动说明
- * @property string|null $order_no 订单编号
- * @property string $capital_type 资金奖励类型
- * @property string|null $contributor_name 资产类型
- * @property float|null $contributor_money 分佣金额/手续费
- * @property int $contributor_id 贡献者id
- * @property int $status 状态,0未结算,1已结算
- * @property int $agented_at 结算时间
- * @property int $created_at 创建时间
- * @property int $updated_at 更新时间
- * @property int $type 0:云库存默认的(货款佣金,奖励之类);1:云仓货款
- */
- class CloudStockDelayLog extends BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_cloud_stock_delay_log}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'wallet_type', 'capital_type', 'contributor_id'], 'required'],
- [['mall_id', 'user_id', 'compute_type', 'day_num', 'contributor_id', 'status', 'agented_at', 'created_at', 'updated_at','type'], 'integer'],
- [['wallet_num', 'contributor_money'], 'number'],
- [['wallet_type', 'capital_type'], 'string', 'max' => 64],
- [['wallet_desc', 'contributor_name'], 'string', 'max' => 255],
- [['order_no'], 'string', 'max' => 100],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => '商城ID',
- 'user_id' => '用户ID',
- 'compute_type' => '结算方式, 0订单完成后,1订单支付后',
- 'wallet_type' => '资产类型',
- 'wallet_num' => '结算资产数量',
- 'day_num' => '延时天数',
- 'wallet_desc' => '资产变动说明',
- 'order_no' => '订单编号',
- 'capital_type' => '资金奖励类型',
- 'contributor_name' => '资产类型',
- 'contributor_money' => '分佣金额/手续费',
- 'contributor_id' => '贡献者id',
- 'status' => '状态,0未结算,1已结算',
- 'agented_at' => '结算时间',
- 'created_at' => '创建时间',
- 'updated_at' => '更新时间',
- ];
- }
- /**
- * @desc:关联会员信息
- * @Author: hua
- * @Date: 2022/1/18
- * @Time: 17:25
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @return \yii\db\ActiveQuery
- */
- public function getUser(): \yii\db\ActiveQuery
- {
- return $this->hasOne(User::class, ['id' => 'user_id'])->select('id,mobile,nickname,avatar_url');
- }
- public static function batchSave($data)
- {
- if (empty($data) || !is_array($data)) return false;
- foreach ($data as $item) {
- if (!is_array($item)) continue;
- $model = new self();
- foreach ($item as $k => $v) {
- $model->$k = $v;
- }
- $model->save();
- }
- return true;
- }
- }
|