| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace addons\Redpack\common\models;
- use Yii;
- /**
- * This is the model class for table "{{%addons_redpack_task}}".
- *
- * @property int $id
- * @property string|null $content 保留执行过那些商场[1,2,3,4]
- * @property string|null $day 执行时间
- * @property int $status 0是禁用,1是启用,-1删除
- * @property int|null $created_at
- * @property int|null $updated_at
- */
- class RedpackTask extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_redpack_task}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['content'], 'string'],
- [['day'], 'safe'],
- [['status', 'created_at', 'updated_at'], 'integer'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'content' => 'Content',
- 'day' => 'Day',
- 'status' => 'Status',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- /**
- * @Author: ltm
- * @DateTime: 2022/3/24 0024 14:37
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @param $data
- * @return string
- */
- public static function setData(array $params,$is_execute){
- try{
- if(!empty($params['id'])){
- $model = self::findOne(['id'=>$params['id']]);
- }else{
- $model = new self();
- $model->loadDefaultValues();
- }
- if(!$model->load($params,'') || !$model->save()){
- throw new Exception($model->getErrorMessage());
- }
- return $model;
- }catch(\Exception $e){
- self::$static_error = $e->getMessage();
- return false;
- }
- }
- }
|