LyImportSignUser.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace addons\AvoidTax\common\models;
  3. use Yii;
  4. use yii\helpers\Json;
  5. /**
  6. * This is the model class for table "qimall_addons_tax_ly_import_sign_user".
  7. *
  8. * @property int $id
  9. * @property int $mall_id
  10. * @property int $user_id
  11. * @property string $batch_num 批次号
  12. * @property string|null $sign_users 导入用户信息
  13. * @property string|null $response 返回的内容
  14. * @property int|null $created_at
  15. * @property int|null $updated_at
  16. */
  17. class LyImportSignUser extends \common\models\base\BaseActiveRecord
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public static function tableName()
  23. {
  24. return '{{%addons_tax_ly_import_sign_user}}';
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['mall_id', 'user_id', 'batch_num'], 'required'],
  33. [['mall_id', 'user_id', 'created_at', 'updated_at'], 'integer'],
  34. [['sign_users', 'response'], 'string'],
  35. [['batch_num'], 'string', 'max' => 32],
  36. ];
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => 'ID',
  45. 'mall_id' => 'Mall ID',
  46. 'user_id' => 'User ID',
  47. 'batch_num' => 'Batch Num',
  48. 'sign_users' => 'Sign Users',
  49. 'response' => 'Response',
  50. 'created_at' => 'Created At',
  51. 'updated_at' => 'Updated At',
  52. ];
  53. }
  54. /**
  55. * 添加用户导入
  56. *
  57. * @param integer $uid
  58. * @param integer $mall_id
  59. * @param string $batch_num
  60. * @param array $sign_users
  61. * @param array $response
  62. * @return boolean
  63. */
  64. public static function addImportSignUser(int $uid, int $mall_id, string $batch_num, array $sign_users, array $response)
  65. {
  66. $model = new static();
  67. $model->user_id = $uid;
  68. $model->mall_id = $mall_id;
  69. $model->batch_num = $batch_num;
  70. $model->sign_users = Json::encode($sign_users);
  71. $model->response = Json::encode($response);
  72. return $model->save();
  73. }
  74. }