Supplier.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use Yii;
  9. use yii\db\ActiveRecord;
  10. use yii\behaviors\TimestampBehavior;
  11. /**
  12. * This is the model class for table "{{%supplier}}".
  13. *
  14. * @property int $id
  15. * @property int|null $store_id
  16. * @property string|null $name
  17. * @property string|null $desc
  18. * @property int|null $sort
  19. * @property int|null $is_delete
  20. * @property int|null $created_at 添加时间
  21. * @property int|null $updated_at 更新时间
  22. * @property int $sale_day
  23. * @property string $supplier_name
  24. * @property int $status
  25. * @property string $password
  26. * @property string $logo
  27. * @property string $phone
  28. * @property int $type
  29. * @property string $certificate
  30. * @property string $id_card_reverse
  31. * @property string $id_card_front
  32. * @property int $admin_id
  33. * @property int $cloud_user_id
  34. * @property int $cloud_supplier_id
  35. * @property string $access_token
  36. * @property string $access_token_time
  37. * @property int $saas_user_id
  38. * @property integer $district_id
  39. * @property integer $city_id
  40. * @property integer $province_id
  41. * @property string $kefu_id
  42. * @property float $rate
  43. * @property float $pool_rate
  44. * @perperty integer $is_stbz
  45. * @property string $custom_form
  46. */
  47. class Supplier extends \yii\db\ActiveRecord
  48. {
  49. /**
  50. * {@inheritdoc}
  51. */
  52. public static function tableName()
  53. {
  54. return '{{%supplier}}';
  55. }
  56. /**
  57. * {@inheritdoc}
  58. */
  59. public function attributeLabels()
  60. {
  61. return [
  62. 'id' => 'ID',
  63. 'access_token' => 'access token',
  64. 'admin_id' => '关联账户id',
  65. 'create_at' => '创建时间',
  66. 'update_at' => '更新时间',
  67. 'name' => '用户名',
  68. 'password' => '密码',
  69. 'phone' => '手机号',
  70. 'logo' => '头像',
  71. 'is_delete' => '是否已删除',
  72. 'type' => '商户类型0 个人 1企业 2个体工商户',
  73. 'certificate' => '资料证书',
  74. 'id_card_reverse' => '身份证反面',
  75. 'id_card_front' => '身份证正面',
  76. 'cloud_user_id' => '云仓id',
  77. 'sale_day' => "售后时间",
  78. 'supplier_name' => "供货商名称",
  79. 'status' => '状态',
  80. 'district_id' => '区',
  81. 'city_id' => '市',
  82. 'province_id' => '省',
  83. 'kefu_id' => '客服id',
  84. 'rate' => '抽成比例',
  85. 'is_stbz' => '是否为胜天半子',
  86. 'custom_form' => '申请供货商自定义表单数据',
  87. ];
  88. }
  89. public function afterSave($insert, $changedAttributes) {
  90. parent::afterSave($insert, $changedAttributes);
  91. if($insert){
  92. if($this->saas_user_id){
  93. $saas_user = SaasUser::findOne($this->saas_user_id);
  94. if($saas_user->parent_id){
  95. SaasSupplierReferral::supplierBindParent($saas_user->parent_id, $this->id);
  96. }
  97. }
  98. }
  99. }
  100. }