| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace addons\Agent\common\models;
- use common\enums\StatusEnum;
- use Exception;
- use RuntimeException;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_agent_supplier_commission_sync_log".
- *
- * @property int $id
- * @property int $mall_id
- * @property int $status -1 执行失败 0未执行 1执行成功
- * @property int $created_at
- * @property int $updated_at
- */
- class AgentSupplierCommissionSyncLog extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_addons_agent_supplier_commission_sync_log';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'status', 'created_at', 'updated_at'], 'integer'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => 'Mall ID',
- 'status' => 'Status',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- /**
- * @param array $params
- *
- * @return bool|self
- */
- public static function setData(array $params)
- {
- try {
- $model = self::findOne(['mall_id' => $params['mall_id']]);
- if (!$model) {
- $model = new self();
- $model->loadDefaultValues();
- }
- if (!$model->load($params, '')) {
- throw new RuntimeException($model->getErrorMessage());
- }
- if (!$model->save()) {
- throw new RuntimeException($model->getErrorMessage());
- }
- return $model;
- } catch (Exception $e) {
- self::$static_error = $e->getMessage();
- return false;
- }
- }
- }
|