ScoreExpansionTask.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace addons\ScoreExpansion\common\models;
  3. use Exception;
  4. use Yii;
  5. /**
  6. * This is the model class for table "qimall_addons_score_expansion_task".
  7. *
  8. * @property int $id
  9. * @property string|null $content 保留执行过那些商场[1,2,3,4]
  10. * @property string|null $day 执行时间
  11. * @property int $status 0是禁用,1是启用,-1删除
  12. * @property int|null $created_at
  13. * @property int|null $updated_at
  14. */
  15. class ScoreExpansionTask extends \common\models\base\BaseActiveRecord
  16. {
  17. /**
  18. * {@inheritdoc}
  19. */
  20. public static function tableName()
  21. {
  22. return 'qimall_addons_score_expansion_task';
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function rules()
  28. {
  29. return [
  30. [['content'], 'string'],
  31. [['day'], 'safe'],
  32. [['status', 'created_at', 'updated_at'], 'integer'],
  33. ];
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function attributeLabels()
  39. {
  40. return [
  41. 'id' => 'ID',
  42. 'content' => 'Content',
  43. 'day' => 'Day',
  44. 'status' => 'Status',
  45. 'created_at' => 'Created At',
  46. 'updated_at' => 'Updated At',
  47. ];
  48. }
  49. /**
  50. * @Author: ltm
  51. * @DateTime: 2022/3/24 0024 14:37
  52. * @Copyright: copyright (c) 2021 广东七件事集团
  53. * @param $data
  54. * @return string
  55. */
  56. public static function setData(array $params,$is_execute){
  57. try{
  58. if(!empty($params['id'])){
  59. $model = self::findOne(['id'=>$params['id']]);
  60. }else{
  61. $model = new self();
  62. $model->loadDefaultValues();
  63. }
  64. if(!$model->load($params,'') || !$model->save()){
  65. throw new Exception($model->getErrorMessage());
  66. }
  67. return $model;
  68. }catch(\Exception $e){
  69. self::$static_error = $e->getMessage();
  70. return false;
  71. }
  72. }
  73. }