| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- namespace addons\Area\common\models;
- use Exception;
- use RuntimeException;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_area_cumulative_reward_log".
- *
- * @property int $id
- * @property int $mall_id
- * @property string $source_table 来源表
- * @property int $source_table_id 来源表id
- * @property int $status 状态[-1:删除;0:禁用;1启用]
- * @property string $wallet_type 奖励类型 commission:佣金 score:积分 digital:数字币
- * @property float $change_num 变动数量
- * @property int $is_return 是否已退回
- * @property int $agent_id qimall_addons_area_agent 表 id
- * @property int $user_id 用户id
- * @property int $level 代理等级
- * @property int $agent_area 代理区域
- * @property int $reward_type 奖励类型
- * @property int $created_at
- * @property int $updated_at
- */
- class AreaCumulativeRewardLog extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_addons_area_cumulative_reward_log';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'source_table_id', 'status', 'is_return', 'agent_id', 'user_id', 'level', 'agent_area', 'created_at', 'updated_at'], 'integer'],
- [['change_num'], 'number'],
- [['source_table'], 'string', 'max' => 255],
- [['wallet_type', 'reward_type'], 'string', 'max' => 50],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => 'Mall ID',
- 'source_table' => 'Source Table',
- 'source_table_id' => 'Source Table ID',
- 'status' => 'Status',
- 'wallet_type' => 'Wallet Type',
- 'change_num' => 'Change Num',
- 'is_return' => 'Is Refund',
- 'agent_id' => 'Agent ID',
- 'user_id' => 'User ID',
- 'level' => 'Level',
- 'agent_area' => 'Agent Area',
- 'reward_type' => 'Reward Type',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- /**
- * @param array $params
- *
- * @return bool|self
- */
- public static function setData(array $params)
- {
- try {
- $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;
- }
- }
- }
|