belongsTo('app\\common\\model\\user\\User'); } /** * 详情 */ public static function detail($order_id, $with = ['user']) { return (new static())->with($with)->find($order_id); } /** * 待支付详情 */ public static function getPayDetail($orderNo) { $model = new static(); return $model->where(['order_no' => $orderNo, 'pay_status' => 10])->with(['user'])->find(); } /** * 新增用户记录 * @param $user_id * @param $data * @return bool */ public static function add($data) { $model = new static; $model->save(array_merge([ 'is_delete' => 0, 'app_id' => $model::$app_id ], $data)); return $model['order_id']; } /** * 获取报名数量 */ public static function getRegNum($activity_id) { return (new static())->where('activity_id', '=', $activity_id) ->where('status', '=', 1) ->where('is_delete', '=', 0) ->count(); } /** * 生成订单号 */ public function orderNo() { return OrderService::createOrderNo(); } }