1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace app\admin\model;
- use support\Model;
- /**
- * 悦享家会员套餐包记录模型
- * Class UserPackageLog
- * @package app\api\model
- */
- class UserPackageLog extends Model
- {
- const NORMAL = '0';
- const RETURN = '1';
- const STOP = '2';
- const PACKAGE_STATUS = [
- self::NORMAL => '正常',
- self::RETURN => '退款',
- self::STOP => '停止'
- ];
- const UPDATED_AT = 'log_update_time';
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected $table = 'user_package_log';
- protected $dateFormat = 'U';
- /**
- * Notes:获取指定条件一列
- * @param string $status
- * @return array
- * User: yym
- * Date: 2022/8/4
- */
- public static function getListIds(string $status)
- {
- return static::select('log_user_id')->where(['log_package_status' => $status])->get()->toArray();
- }
- /**
- * Notes:获取会员单条记录
- * @param int $package_id
- * @param int $user_id
- * @return array
- * User: yym
- * Date: 2022/11/21
- */
- public static function getInfo(int $package_id, int $user_id)
- {
- return static::where(['log_user_id' => $user_id, 'log_package_id' => $package_id, 'log_package_status' => static::NORMAL])
- ->get()
- ->toArray();
- }
- /**
- * Notes:插入记录
- * @param array $data
- * @return int
- * User: yym
- * Date: 2022/8/5
- */
- public static function insertData(array $data)
- {
- return static::insertGetId($data);
- }
- }
|