diff --git a/app/api/controller/order/CashierinfoController.php b/app/api/controller/order/CashierinfoController.php new file mode 100644 index 0000000..6dfd466 --- /dev/null +++ b/app/api/controller/order/CashierinfoController.php @@ -0,0 +1,46 @@ +dataLists(new CashierinfoLists()); + } + + /** + * @notes 获取零售订单详情详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/24 10:11 + */ + public function detail() + { + $params = (new CashierinfoValidate())->goCheck('detail'); + $result = CashierinfoLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/api/controller/order/RetailOrderController.php b/app/api/controller/order/RetailOrderController.php index 3879b5a..019da4e 100644 --- a/app/api/controller/order/RetailOrderController.php +++ b/app/api/controller/order/RetailOrderController.php @@ -14,6 +14,7 @@ use app\common\logic\PaymentLogic; use app\common\logic\PayNotifyLogic; use app\common\model\order\Cart; use app\common\model\retail\Cashierclass; +use app\common\model\retail\Cashierinfo; use app\common\model\user\User; use app\common\model\user\UserAddress; use app\common\service\wechat\WeChatConfigService; @@ -31,6 +32,35 @@ class RetailOrderController extends BaseApiController return $this->dataLists(new RetailOrderList()); } + /** + * 收银机对应的采购零售订单列表 + */ + public function merchant_order_list() + { + $number = $this->request->get('number'); + $page_no = $this->request->get('page_no', 1); + $date = $this->request->get('date', date('Y-m-d')); + if(!$this->userInfo['merchant']['mer_id']){ + return $this->fail('没有权限'); + } + $where=[]; + if($number){ + $where[] = ['number', 'like', '%' . $number . '%']; + } + $where[] = ['merchant', '=',$this->userInfo['merchant']['mer_id']]; + $where[] = ['paid', '=',1]; + $res = Cashierclass::where($where)->page($page_no, 25)->whereDay('create_time', $date) + ->select()->each(function($item){ + $item['goods_list']=Cashierinfo::where('pid',$item['id'])->with('goodsName')->field('goods,nums,price sell')->limit(5)->select(); + $item['goods_count']=count(explode(',',$item['cart_id'])); + }); + $data['count'] = Cashierclass::where($where)->whereDay('create_time', $date)->count(); + $data['lists'] = $res?->toArray(); + $data['page_no'] = $page_no; + $data['page_siz'] = 15; + return $this->success('ok', $data); + } + public function order_count() { $userId = $this->request->userId; diff --git a/app/api/controller/user/AddressController.php b/app/api/controller/user/AddressController.php index 708ff94..55bd819 100644 --- a/app/api/controller/user/AddressController.php +++ b/app/api/controller/user/AddressController.php @@ -6,6 +6,7 @@ use app\api\controller\BaseApiController; use app\api\lists\user\UserAddressList; use app\api\logic\user\AddressLogic; use app\api\validate\UserAddressValidate; +use app\common\model\retail\Cashierclass; class AddressController extends BaseApiController { @@ -29,6 +30,26 @@ class AddressController extends BaseApiController return $this->fail(AddressLogic::getError()); } } + /** + * 商户给用户添加地址 + */ + public function merchant_create() + { + $params = (new UserAddressValidate())->post()->goCheck('add'); + if($params['order_id'] && $params['order_id']!=0){ + $uid=Cashierclass::where('id',$params['order_id'])->value('uid'); + if(!$uid || $uid<=0){ + return $this->fail('订单不存在'); + } + } + $params['uid'] = $uid; + $res=AddressLogic::add($params); + if($res){ + return $this->success('添加成功'); + }else{ + return $this->fail(AddressLogic::getError()); + } + } /** * @notes 编辑地址 * @return \think\response\Json diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 83c64f4..26e0473 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -185,16 +185,16 @@ class OrderLogic extends BaseLogic return false; } $mer_id = $user['merchant']['mer_id']; - $merchant = Merchant::where('mer_id', $mer_id)->find(); + // $merchant = Merchant::where('mer_id', $mer_id)->find(); $orderInfo = self::cartIdByPurchaseOrderInfo($user, $params); if (!$orderInfo) { return false; } $_order = $orderInfo['order']; - if ($_order['total'] < $merchant['mer_money']) { - self::setError('商户余额不足'); - return false; - } + // if ($_order['total'] < $merchant['mer_money']) { + // self::setError('商户余额不足'); + // return false; + // } $_order['merchant'] = $mer_id; $_order['money'] = $_order['total']; $_order['actual'] = $_order['total']; @@ -208,7 +208,7 @@ class OrderLogic extends BaseLogic $goods_list[$k]['nums'] = $v['cart_num']; } (new Opurchaseinfo())->saveAll($goods_list); - $merchant->mer_money = bcsub($merchant->mer_money, $_order['total'], 2); + // $merchant->mer_money = bcsub($merchant->mer_money, $_order['total'], 2); $order_arr = explode(',', $_order['order_arr']); Cashierclass::where('id', 'in', $order_arr)->update(['is_opurchase' => 1]); Db::commit(); diff --git a/config/plugin/webman/push/route.php b/config/plugin/webman/push/route.php index ea54c37..aa7757a 100644 --- a/config/plugin/webman/push/route.php +++ b/config/plugin/webman/push/route.php @@ -76,9 +76,9 @@ Route::post(parse_url(config('plugin.webman.push.app.channel_hook'), PHP_URL_PAT // 业务根据需要处理上下线的channel,例如将在线状态写入数据库,通知其它channel等 // 上线的所有channel - echo 'online channels: ' . implode(',', $channels_online) . "\n"; + // echo 'online channels: ' . implode(',', $channels_online) . "\n"; // 下线的所有channel - echo 'offline channels: ' . implode(',', $channels_offline) . "\n"; + // echo 'offline channels: ' . implode(',', $channels_offline) . "\n"; return 'OK'; });