| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- namespace addons\CloudStock\common\models;
- use common\models\base\BaseActiveRecord;
- use common\models\goods\Goods;
- use common\models\user\User;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_cloud_stock_payment_log".
- *
- * @property int $id
- * @property int $mall_id
- * @property int $store_id
- * @property int $user_id 会员id
- * @property int $buy_user_id 来源会员id
- * @property int $goods_id 商品id
- * @property string $goods_name 商品名称
- * @property string $pic_url 商品主图
- * @property int $order_id 订单id
- * @property int $order_detail_id 订单详情id
- * @property int $num 商品件数
- * @property string $order_no 订单编号
- * @property string $type 货款类型:fill:补货货款;buy:会员买货
- * @property float $money 金额
- * @property int|null $status 状态[-1:删除;0:待结算;1已结算]
- * @property int $created_at
- * @property int $updated_at
- */
- class CloudStockPaymentLog extends BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_cloud_stock_payment_log}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'store_id', 'order_detail_id', 'num'], 'required'],
- [['mall_id', 'user_id', 'buy_user_id', 'goods_id', 'order_id', 'order_detail_id', 'num', 'status', 'created_at', 'updated_at'], 'integer'],
- [['money'], 'number'],
- [['order_no'], 'string', 'max' => 100],
- [['type'], 'string', 'max' => 50],
- [['goods_name', 'pic_url'], 'string', 'max' => 255],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => 'Mall ID',
- 'store_id' => 'store_id',
- 'type' => 'type',
- 'user_id' => 'User ID',
- 'buy_user_id' => 'Buy User ID',
- 'goods_id' => 'Goods ID',
- 'order_id' => 'Order ID',
- 'order_detail_id' => 'Order Detail ID',
- 'num' => 'Num',
- 'order_no' => 'Order No',
- 'money' => 'Money',
- 'status' => 'Status',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- public function getBuyUser()
- {
- return $this->hasOne(User::class, ['id' => 'buy_user_id']);
- }
- public static function add(array $params)
- {
- try {
- $model = new self();
- $model->loadDefaultValues();
- if (!$model->load($params, '')) throw new \Exception($model->getErrorMessage());
- if (!$model->save()) throw new \Exception($model->getErrorMessage());
- return $model;
- } catch (\Exception $e) {
- self::$static_error = $e->getMessage();
- return false;
- }
- }
- }
|