| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- // +----------------------------------------------------------------------
- // | 商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2017~2021 https://www.thinkphp.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
- // +----------------------------------------------------------------------
- // | Author: thinkphp <admin@yiovo.com>
- // +----------------------------------------------------------------------
- declare (strict_types=1);
- namespace app\common\model;
- use cores\BaseModel;
- /**
- * 解锁生源用户订单模型类
- * Class UnlockOrder
- * @package app\common\model
- */
- class UnlockOrder extends BaseModel
- {
- protected $globalScope = [''];
- // 定义表名
- protected $name = 'unlock_order';
- // 定义主键
- protected $pk = 'order_id';
- /**
- * 关联会员记录表
- * @return \think\model\relation\BelongsTo
- */
- public function user()
- {
- $module = self::getCalledModule();
- return $this->belongsTo("app\\{$module}\\model\\User");
- }
- /**
- * 付款时间
- * @param $value
- * @return array
- */
- public function getPayTimeAttr($value)
- {
- return format_time($value);
- }
- /**
- * 获取订单详情
- * @param $where
- * @return array|null|\think\Model
- */
- public static function detail($where)
- {
- return static::get($where);
- }
- /**
- * 获取老师已解锁的学校ID
- * @param $userId
- * @return array
- */
- public static function getSchoolsByUser($userId)
- {
- return self::where(['user_id'=> $userId,'status'=>2])
- ->column('school_id');
- }
- }
|