| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Services\Common;
- use App\Models\OrderModel;
- use App\Services\BaseService;
- /**
- * 积分商城订单管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * Class OrderService
- * @package App\Services\Common
- */
- class OrderService extends BaseService
- {
- // 静态对象
- protected static $instance = null;
- /**
- * 构造函数
- * @author laravel开发员
- * @since 2020/11/11
- * OrderService constructor.
- */
- public function __construct()
- {
- $this->model = new OrderModel();
- }
- /**
- * 静态入口
- * @return static|null
- */
- public static function make()
- {
- if (!self::$instance) {
- self::$instance = (new static());
- }
- return self::$instance;
- }
- /**
- * 添加或编辑
- * @return array
- * @since 2020/11/11
- * @author laravel开发员
- */
- public function edit()
- {
- $data = request()->all();
- return parent::edit($data); // TODO: Change the autogenerated stub
- }
- /**
- * 抢拍交易订单数
- * @param $userId 用户ID
- * @param int $status 状态
- * @return mixed
- */
- public function getNewTradeCount($userId, $status=0, $time=30)
- {
- $where = ['user_id'=>$userId,'mark'=>1,'is_read'=>0];
- return $this->model->where($where)
- ->where(function($query) use($status){
- $query->whereIn('status',is_array($status)? $status:[$status]);
- })
- ->where(function($query) use($time){
- if($time){
- $query->where('update_time','>', $time);
- }
- })
- ->count('id');
- }
- }
|