| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- use Yii;
- use yii\db\ActiveRecord;
- use yii\behaviors\TimestampBehavior;
- /**
- * This is the model class for table "{{%supplier}}".
- *
- * @property int $id
- * @property int|null $store_id
- * @property string|null $name
- * @property string|null $desc
- * @property int|null $sort
- * @property int|null $is_delete
- * @property int|null $created_at 添加时间
- * @property int|null $updated_at 更新时间
- * @property int $sale_day
- * @property string $supplier_name
- * @property int $status
- * @property string $password
- * @property string $logo
- * @property string $phone
- * @property int $type
- * @property string $certificate
- * @property string $id_card_reverse
- * @property string $id_card_front
- * @property int $admin_id
- * @property int $cloud_user_id
- * @property int $cloud_supplier_id
- * @property string $access_token
- * @property string $access_token_time
- * @property int $saas_user_id
- * @property integer $district_id
- * @property integer $city_id
- * @property integer $province_id
- * @property string $kefu_id
- * @property float $rate
- * @property float $pool_rate
- * @perperty integer $is_stbz
- * @property string $custom_form
- */
- class Supplier extends \yii\db\ActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%supplier}}';
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'access_token' => 'access token',
- 'admin_id' => '关联账户id',
- 'create_at' => '创建时间',
- 'update_at' => '更新时间',
- 'name' => '用户名',
- 'password' => '密码',
- 'phone' => '手机号',
- 'logo' => '头像',
- 'is_delete' => '是否已删除',
- 'type' => '商户类型0 个人 1企业 2个体工商户',
- 'certificate' => '资料证书',
- 'id_card_reverse' => '身份证反面',
- 'id_card_front' => '身份证正面',
- 'cloud_user_id' => '云仓id',
- 'sale_day' => "售后时间",
- 'supplier_name' => "供货商名称",
- 'status' => '状态',
- 'district_id' => '区',
- 'city_id' => '市',
- 'province_id' => '省',
- 'kefu_id' => '客服id',
- 'rate' => '抽成比例',
- 'is_stbz' => '是否为胜天半子',
- 'custom_form' => '申请供货商自定义表单数据',
- ];
- }
-
- public function afterSave($insert, $changedAttributes) {
- parent::afterSave($insert, $changedAttributes);
- if($insert){
- if($this->saas_user_id){
- $saas_user = SaasUser::findOne($this->saas_user_id);
- if($saas_user->parent_id){
- SaasSupplierReferral::supplierBindParent($saas_user->parent_id, $this->id);
- }
- }
- }
- }
- }
|