| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace addons\ScoreBonus\common\models;
- use Yii;
- use common\models\base\BaseActiveRecord;
- use yii\behaviors\TimestampBehavior;
- use yii\db\Exception;
- /**
- * This is the model class for table "{{%addon_default}}".
- */
- class ScoreBonusErrorLogModel extends BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_score_bonus_error_log}}';
- }
-
- public function rules()
- {
- return [
- [['mall_id','bid', 'created_at', 'updated_at', 'date_time'], 'integer'],
- [['error_log', 'json_data'], 'string'],
- ];
- }
- /**
- * 保存数据
- * @Author: lun
- * @DateTime: 2023/6/2 0002 15:53
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @param $params
- * @return bool
- */
- public static function setData(array $params)
- {
- try {
- $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;
- }
- }
- public static function getDataOne($params = [], $orderBy = 'id desc')
- {
- return self::find()->where($params)->orderBy($orderBy)->asArray()->one();
- }
- }
|