CardSecretImportFailLog.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace addons\CardSecret\common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%addons_CardSecret_import_fail_log}}".
  6. *
  7. * @property int $id
  8. * @property int|null $mall_id 商城ID
  9. * @property string|null $name 卡号名称
  10. * @property string|null $password 卡号密码
  11. * @property int|null $use_status 使用状态 (1.未领取,2.待领取,3.已失效)
  12. * @property int|null $status 状态(-1是已删除,0是禁用,1是正常)
  13. * @property int|null $import_id 导入ID
  14. * @property int|null $created_at 创建时间
  15. * @property int|null $updated_at 更新时间
  16. * @property int|null $cate_id 分类ID
  17. */
  18. class CardSecretImportFailLog extends \common\models\base\BaseActiveRecord
  19. {
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public static function tableName()
  24. {
  25. return '{{%addons_card_secret_import_fail_log}}';
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function rules()
  31. {
  32. return [
  33. [['mall_id', 'use_status', 'status', 'import_id', 'created_at', 'updated_at', 'cate_id'], 'integer'],
  34. [['name', 'password'], 'string', 'max' => 255],
  35. ];
  36. }
  37. /**
  38. * {@inheritdoc}
  39. */
  40. public function attributeLabels()
  41. {
  42. return [
  43. 'id' => 'ID',
  44. 'mall_id' => '商城ID',
  45. 'name' => '卡号名称',
  46. 'password' => '卡号密码',
  47. 'use_status' => '使用状态 (1.未领取,2.待领取,3.已失效)',
  48. 'status' => '状态(-1是已删除,0是禁用,1是正常)',
  49. 'import_id' => '导入ID',
  50. 'created_at' => '创建时间',
  51. 'updated_at' => '更新时间',
  52. 'cate_id' => '分类ID',
  53. ];
  54. }
  55. /**
  56. * 保存数据
  57. * @Author: ltm
  58. * @DateTime: 2022/5/6 0022 17:13
  59. * @Copyright: copyright (c) 2021 广东七件事集团
  60. * @param array $params
  61. * @return string
  62. */
  63. public static function setData(array $params){
  64. try{
  65. $model = new self();
  66. $model->loadDefaultValues();
  67. $model->mall_id = $params['mall_id'];
  68. if(!$model->load($params,'') || !$model->save()){
  69. throw new Exception($model->getErrorMessage());
  70. }
  71. return $model;
  72. }catch(\Exception $e){
  73. self::$static_error = $e->getMessage();
  74. return false;
  75. }
  76. }
  77. }