wesmiler 2 mesiacov pred
rodič
commit
a02eea6834

+ 0 - 2
app/Http/Controllers/Api/v1/IndexController.php

@@ -128,9 +128,7 @@ class IndexController extends webApp
 
 
                 $params['user_id'] = $this->userId;
                 $params['user_id'] = $this->userId;
                 $data['stores'] = StoreService::make()->getGoodsList($params);
                 $data['stores'] = StoreService::make()->getGoodsList($params);
-                //$data['social_open'] = ConfigService::make()->getConfigByCode('social_open', 0);
                 $data['pay_recharge_open'] = ConfigService::make()->getConfigByCode('pay_recharge_open', 0);
                 $data['pay_recharge_open'] = ConfigService::make()->getConfigByCode('pay_recharge_open', 0);
-//                $data['cart_count'] = CartService::make()->getCount($this->userId);
             }
             }
 
 
             return showJson(1010, true, $data);
             return showJson(1010, true, $data);

+ 0 - 3
app/Http/Controllers/Api/v1/LoginController.php

@@ -5,11 +5,8 @@ namespace App\Http\Controllers\Api\v1;
 use App\Http\Controllers\Api\webApp;
 use App\Http\Controllers\Api\webApp;
 use App\Http\Validator\MemberValidator;
 use App\Http\Validator\MemberValidator;
 use App\Services\Api\MemberService;
 use App\Services\Api\MemberService;
-use App\Services\ConfigService;
 use App\Services\RedisService;
 use App\Services\RedisService;
 use App\Services\SmsService;
 use App\Services\SmsService;
-use App\Services\WechatService;
-use Illuminate\Http\Request;
 
 
 /**
 /**
  * 授权登录控制器基类
  * 授权登录控制器基类

+ 0 - 3
app/Http/Controllers/Api/v1/OrderController.php

@@ -5,10 +5,7 @@ namespace App\Http\Controllers\Api\v1;
 use App\Http\Controllers\Api\webApp;
 use App\Http\Controllers\Api\webApp;
 use App\Http\Validator\OrderValidator;
 use App\Http\Validator\OrderValidator;
 use App\Services\Api\AccountService;
 use App\Services\Api\AccountService;
-use App\Services\Api\MemberService;
 use App\Services\Api\OrderService;
 use App\Services\Api\OrderService;
-use App\Services\ConfigService;
-use App\Services\Kd100Service;
 
 
 /**
 /**
  * 订单
  * 订单

+ 1 - 1
app/Services/Api/StoreService.php

@@ -94,7 +94,7 @@ class StoreService extends BaseService
      * @param int $pageSize
      * @param int $pageSize
      * @return array
      * @return array
      */
      */
-    public function getGoodsList($params, $pageSize = 7)
+    public function getGoodsList($params, $pageSize = 3)
     {
     {
         $userId = isset($params['user_id'])? $params['user_id'] : 0;
         $userId = isset($params['user_id'])? $params['user_id'] : 0;
         $cacheKey = "caches:stores:index_goods_{$userId}_{$pageSize}:".md5(json_encode($params));
         $cacheKey = "caches:stores:index_goods_{$userId}_{$pageSize}:".md5(json_encode($params));

+ 0 - 312
app/Services/Common/OrderService.php

@@ -306,318 +306,6 @@ class OrderService extends BaseService
     }
     }
 
 
     /**
     /**
-     * 订单审核
-     * @return bool
-     */
-    public function confirm($adminId, $params)
-    {
-        $id = isset($params['id']) ? intval($params['id']) : 0;
-        $remark = isset($params['remark']) ? trim($params['remark']) : '';
-        $checkStatus = isset($params['status']) ? intval($params['status']) : 0;
-        if (!in_array($checkStatus, [2, 9])) {
-            $this->error = '请选择审核状态';
-            return false;
-        }
-
-        $info = $this->model->with(['user', 'goods'])->where(['id' => $id, 'mark' => 1])->first();
-        $userInfo = isset($info['user']) ? $info['user'] : [];
-        $goods = isset($info['goods']) ? $info['goods'] : [];
-        $status = isset($info['status']) ? $info['status'] : 0;
-        $orderUserId = isset($info['user_id']) ? $info['user_id'] : 0;
-        $goodsId = isset($info['goods_id']) ? $info['goods_id'] : 0;
-        if (empty($info) || empty($goods) || empty($userInfo) || $goodsId <= 0 || $orderUserId <= 0) {
-            $this->error = '订单信息不存在或参数错误';
-            return false;
-        }
-
-        if ($status != 1) {
-            $this->error = '订单状态不可操作';
-            return false;
-        }
-
-        // 审核通过
-        if ($checkStatus == 2) {
-            if ($this->model->where(['goods_id' => $goodsId, 'status' => 3, 'mark' => 1])->value('id')) {
-                $this->error = '该货物订单已完成';
-                return false;
-            }
-
-            if ($this->model->where(['goods_id' => $goodsId, 'status' => 2, 'mark' => 1])->value('id')) {
-                $this->error = '该货物存在订单进行中,已审核通过其他司机';
-                return false;
-            }
-        }
-
-
-        DB::beginTransaction();
-        if (!$this->model->where(['id' => $id])->update(['status' => $checkStatus, 'confirm_admin_id' => $adminId, 'confirm_at' => date('Y-m-d H:i:s'), 'remark' => $remark, 'update_time' => time()])) {
-            DB::rollBack();
-            $this->error = '订单审核失败';
-            return false;
-        }
-
-        if ($checkStatus == 2 && !GoodsModel::where(['id' => $goodsId])->update(['picker_status' => 2, 'update_time' => time()])) {
-            DB::rollBack();
-            $this->error = '订单审核失败';
-            return false;
-        }
-
-        //      // 用户数据更新
-        $updateData = ['update_time' => time()];
-        if ($checkStatus == 2) {
-            // 接单数量
-            $updateData['picker_order_num'] = DB::raw("picker_order_num + 1");
-        } else {
-            // 审核不过自动设置不可接单
-            $updateData['picker_status'] = 2;
-        }
-        if (!MemberModel::where(['id' => $orderUserId])->update($updateData)) {
-            DB::rollBack();
-            $this->error = '订单审核失败';
-            return false;
-        }
-
-        DB::commit();
-
-        RedisService::keyDel("caches:orders:checkOrder:*");
-        RedisService::keyDel("caches:members:info*");
-        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "订单审核", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
-        ActionLogModel::record();
-
-        $this->error = '订单审核成功';
-        return ['id' => $id];
-    }
-
-    /**
-     * 订单取消
-     * @return bool
-     */
-    public function cancel($adminId, $params)
-    {
-        $id = isset($params['id']) ? intval($params['id']) : 0;
-        $remark = isset($params['remark']) ? trim($params['remark']) : '';
-
-        $info = $this->model->with(['user', 'goods'])->where(['id' => $id, 'mark' => 1])->first();
-        $userInfo = isset($info['user']) ? $info['user'] : [];
-        $goods = isset($info['goods']) ? $info['goods'] : [];
-        $status = isset($info['status']) ? $info['status'] : 0;
-        $orderUserId = isset($info['user_id']) ? $info['user_id'] : 0;
-        $goodsId = isset($info['goods_id']) ? $info['goods_id'] : 0;
-        if (empty($info) || empty($goods) || empty($userInfo) || $goodsId <= 0 || $orderUserId <= 0) {
-            $this->error = '订单信息不存在或参数错误';
-            return false;
-        }
-
-        if ($status == 9) {
-            $this->error = '订单已取消';
-            return false;
-        }
-
-        if ($status == 3) {
-            $this->error = '订单已完成';
-            return false;
-        }
-
-        DB::beginTransaction();
-        if (!$this->model->where(['id' => $id])->update(['status' => 9, 'confirm_admin_id' => $adminId, 'confirm_at' => date('Y-m-d H:i:s'), 'remark' => $remark, 'update_time' => time()])) {
-            DB::rollBack();
-            $this->error = '订单取消失败';
-            return false;
-        }
-
-        $pickerOrderNum = isset($userInfo['picker_order_num']) ? $userInfo['picker_order_num'] : 0;
-        if (!MemberModel::where(['id' => $orderUserId])->update(['picker_order_num' => $pickerOrderNum ? DB::raw("picker_order_num - 1") : 0, 'update_time' => time()])) {
-            DB::rollBack();
-            $this->error = '订单取消失败';
-            return false;
-        }
-
-        if (!GoodsModel::where(['id' => $goodsId])->update(['picker_status' => 1, 'update_time' => time()])) {
-            DB::rollBack();
-            $this->error = '订单取消失败';
-            return false;
-        }
-
-        DB::commit();
-
-        RedisService::keyDel("caches:orders:checkOrder:*");
-        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "订单取消", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
-        ActionLogModel::record();
-
-        $this->error = '订单取消成功';
-        return ['id' => $id];
-    }
-
-    /**
-     * 订单完成
-     * @return bool
-     */
-    public function complete($adminId, $params)
-    {
-        $id = isset($params['id']) ? intval($params['id']) : 0;
-        $remark = isset($params['remark']) ? trim($params['remark']) : '';
-
-        $info = $this->model->with(['user', 'goods'])->where(['id' => $id, 'mark' => 1])->first();
-        $userInfo = isset($info['user']) ? $info['user'] : [];
-        $goods = isset($info['goods']) ? $info['goods'] : [];
-        $status = isset($info['status']) ? $info['status'] : 0;
-        $orderUserId = isset($info['user_id']) ? $info['user_id'] : 0;
-        $goodsId = isset($info['goods_id']) ? $info['goods_id'] : 0;
-        $bonus = isset($info['bonus']) ? $info['bonus'] : 0;
-        $orderUser = isset($info['user']) ? $info['user'] : [];
-        if (empty($info) || empty($goods) || empty($userInfo) || $goodsId <= 0 || $orderUserId <= 0) {
-            $this->error = '订单信息不存在或参数错误';
-            return false;
-        }
-
-        if ($status != 2) {
-            $this->error = '订单状态不可操作';
-            return false;
-        }
-
-        DB::beginTransaction();
-        if (!$this->model->where(['id' => $id])->update(['status' => 3, 'confirm_admin_id' => $adminId, 'confirm_at' => date('Y-m-d H:i:s'), 'remark' => $remark, 'update_time' => time()])) {
-            DB::rollBack();
-            $this->error = '订单确认完成失败';
-            return false;
-        }
-
-        // 收入结算
-        if ($bonus > 0) {
-            $updateData = [
-                'balance' => DB::raw("balance + {$bonus}"),
-                'income_total' => DB::raw("income_total + {$bonus}"),
-                'complete_order_num' => DB::raw("complete_order_num + 1"),
-                'update_time' => time()
-            ];
-            if (!MemberModel::where(['id' => $orderUserId])->update($updateData)) {
-                DB::rollBack();
-                $this->error = '订单确认完成收入结算失败';
-                return false;
-            }
-
-            // 收入记录
-            $balance = isset($userInfo['balance']) ? $userInfo['balance'] : 0;
-            $log = [
-                'user_id' => $orderUserId,
-                'source_order_no' => isset($info['order_no']) ? $info['order_no'] : '',
-                'type' => 1,
-                'money' => $bonus,
-                'before_money' => $balance,
-                'date' => date('Y-m-d'),
-                'create_time' => time(),
-                'remark' => '订单收入',
-                'status' => 1,
-                'mark' => 1,
-            ];
-            if (!AccountLogModel::insertGetId($log)) {
-                DB::rollBack();
-                $this->error = '订单确认完成收入结算失败';
-                return false;
-            }
-        }
-
-
-        if (!GoodsModel::where(['id' => $goodsId])->update(['picker_status' => 3, 'update_time' => time()])) {
-            DB::rollBack();
-            $this->error = '订单确认完成失败';
-            return false;
-        }
-
-        // 公告消息
-        $realname = isset($orderUser['realname']) ? $orderUser['realname'] : '';
-        $realname = $realname ? get_realname($realname) : '师傅';
-        $shipperAddress = isset($goods['shipper_address']) ? get_address($goods['shipper_address']) : '';
-        $receiverAddress = isset($goods['receiver_address']) ? get_address($goods['receiver_address']) : '';
-        $title = "{$realname}已完成从{$shipperAddress}到{$receiverAddress}的订单";
-        NoticeService::make()->saveNotice($title);
-
-        RedisService::keyDel("caches:orders:checkOrder:*");
-        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "订单确认完成", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
-        ActionLogModel::record();
-
-        DB::commit();
-        $this->error = '订单确认完成成功';
-        return ['id' => $id];
-    }
-
-    /**
-     * 删除订单
-     */
-    public function delete()
-    {
-        $id = request()->post('id');
-        if (!$id) {
-            return ['code' => 1, 'msg' => '参数错误'];
-        }
-
-        if (is_array($id)) {
-            $result = $this->model->whereIn('id', $id)->update(['mark' => 0]);
-        } else {
-            $result = $this->model->where('id', $id)->update(['mark' => 0]);
-        }
-
-        if ($result) {
-            ActionLogModel::setTitle("删除订单");
-            ActionLogModel::record();
-            RedisService::keyDel("caches:orders:*");
-            return ['code' => 0, 'msg' => '删除成功'];
-        }
-
-        return ['code' => 1, 'msg' => '删除失败'];
-    }
-
-    /**
-     * 更新订单状态
-     */
-    public function status()
-    {
-        $id = request()->post('id');
-        $status = request()->post('status');
-        $refundStatus = request()->post('refund_status');
-        $refundRemark = request()->post('refund_remark', '');
-
-        if (!$id) {
-            return ['code' => 1, 'msg' => '参数错误'];
-        }
-
-        $updateData = ['update_time' => time()];
-
-        // 更新订单状态
-        if ($status !== null) {
-            $updateData['status'] = $status;
-
-            // 如果是完成订单,计算佣金
-            if ($status == 4) {
-                $order = $this->model->find($id);
-                if ($order) {
-                    $updateData['bonus'] = round($order->pay_total * 0.05, 2);
-                }
-            }
-        }
-
-        // 更新退款状态
-        if ($refundStatus !== null) {
-            $updateData['refund_status'] = $refundStatus;
-            $updateData['refund_remark'] = $refundRemark;
-
-            // 如果同意退款,保持原订单状态不变
-            // 退款状态通过 refund_status 字段管理
-        }
-
-        $result = $this->model->where('id', $id)->update($updateData);
-
-        if ($result !== false) {
-            ActionLogModel::setTitle("更新订单状态");
-            ActionLogModel::record();
-            RedisService::keyDel("caches:orders:*");
-            return ['code' => 0, 'msg' => '操作成功'];
-        }
-
-        return ['code' => 1, 'msg' => '操作失败'];
-    }
-
-    /**
      * 完成支付
      * 完成支付
      */
      */
     public function completePay()
     public function completePay()