| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- namespace app\models;
- use yii\behaviors\TimestampBehavior;
- use yii\db\ActiveRecord;
- /**
- * This is the model class for table "{{%wallet_log_coin}}".
- *
- * @property int $id ID
- * @property int $store_id 商城ID
- * @property int $user_id 用户ID
- * @property int $saas_id 联盟ID
- * @property float $money 资金变动(支持负数)
- * @property float $before_money 变动前金额
- * @property string $desc 关联表
- * @property string $type
- * @property string $created_at 创建时间
- * @property string $update_at 更新时间
- */
- class WalletLogCoin extends \yii\db\ActiveRecord
- {
- public static function tableName()
- {
- return '{{%wallet_log_coin}}';
- }
- public function behaviors()
- {
- return [
- [
- 'class' => TimestampBehavior::class,
- 'attributes' => [
- ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'],
- ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at']
- ]
- ]
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['store_id', 'user_id', 'money', 'before_money'], 'required'],
- [['id','store_id', 'user_id', 'saas_id', 'source_id', 'created_at', 'updated_at'], 'integer'],
- [['money', 'before_money'], 'number'],
- [['type'], 'string', 'max' => 32],
- [['currency_code','source_table'], 'string', 'max' => 64],
- [['desc'], 'string', 'max' => 255],
- [['extra'],'string']
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => '商城ID',
- 'user_id' => '用户ID',
- 'saas_id' => '联盟ID',
- 'currency_code' => '货币代码',
- 'money' => '资金变动(支持负数)',
- 'before_money' => '变动前金额',
- 'type' => '类型',
- 'source_table' => '关联表',
- 'source_id' => '关联表id',
- 'desc' => '描述',
- 'extra' => '额外信息',
- 'created_at' => '创建时间',
- 'updated_at' => '更新时间',
- ];
- }
- public function getUser()
- {
- return $this->hasOne(User::class, ['id' => 'user_id']);
- }
- }
|