| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- namespace common\models\finance;
- use Yii;
- use yii\db\Exception;
- /**
- * This is the model class for table "qimall_platform_finance_log".
- *
- * @property int $id
- * @property string|null $out_trade_no 系统支付流水号
- * @property int $consumer_id 消费者ID
- * @property string $consumer_type 消费者类型[mall=商城,agent=代理商]
- * @property string $change_type 操作类型:add-增加,sub-减少
- * @property float $change_num 操作数量
- * @property float $current_num 当前数量
- * @property string $desc 变动说明
- * @property string $source_table 来源表
- * @property int $source_table_id 操作来源业务id
- * @property string $from_type 来源类型
- * @property int $status 状态,-1:失效,1:正常,2:冻结
- * @property int $created_at 添加时间戳
- * @property int $updated_at 更新时间戳
- * @property int $payment_type 支付类型
- */
- class PlatformFinanceLog extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_platform_finance_log';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['consumer_id', 'source_table_id', 'status', 'created_at', 'updated_at','payment_type'], 'integer'],
- [['change_num', 'current_num'], 'number'],
- [['out_trade_no'], 'string', 'max' => 100],
- [['consumer_type'], 'string', 'max' => 20],
- [['change_type'], 'string', 'max' => 12],
- [['desc', 'source_table', 'from_type'], 'string', 'max' => 255],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'out_trade_no' => '系统支付流水号',
- 'consumer_id' => '消费者ID',
- 'consumer_type' => '消费者类型[mall=商城,agent=代理商]',
- 'change_type' => '操作类型:add-增加,sub-减少',
- 'change_num' => '操作数量',
- 'current_num' => '当前数量',
- 'desc' => '变动说明',
- 'source_table' => '来源表',
- 'source_table_id' => '操作来源业务id',
- 'from_type' => '来源类型',
- 'status' => '状态,-1:失效,1:正常,2:冻结',
- 'created_at' => '添加时间戳',
- 'updated_at' => '更新时间戳',
- 'payment_type' => '支付类型',
- ];
- }
- /**
- * @Author: ltm
- * @DateTime: 2022/3/3 0003 18:06
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @param $data
- * @return string
- */
- public static function setData($params)
- {
- try {
- if (!empty($params['id'])) {
- $model = self::findOne(['id' => $params['id']]);
- } else {
- $model = new self();
- $model->loadDefaultValues();
- }
- if (empty($model)) throw new Exception('查无此订单');
- if (!$model->load($params, '') || !$model->save()) throw new Exception($model->getErrorMessage());
- return $model;
- } catch (\Exception $e) {
- self::setStaticError($e->getMessage());
- return false;
- }
- }
- }
|