From b93ee02d31fc22ff08860046766039462fc2eef5 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 8 Nov 2024 03:33:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(api):=20=E6=B7=BB=E5=8A=A0=E9=A2=84?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AE=B0=E5=BD=95=E6=9F=A5=E7=9C=8B=E5=92=8C?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 view_beforehand_order_record 和 view_beforehand_order_record_enter 方法 - 实现预订单记录查看页面和审核功能 - 添加微信企业号消息发送测试代码 - 优化订单价格计算逻辑 --- app/api/controller/IndexController.php | 89 +++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index d72bd27f3..fbe6fec60 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -2,6 +2,7 @@ namespace app\api\controller; +use app\admin\logic\beforehand_order\BeforehandOrderLogic; use app\admin\logic\store_branch_product\StoreBranchProductLogic; use app\common\logic\StoreFinanceFlowLogic; use app\admin\logic\store_product\StoreProductLogic; @@ -10,14 +11,18 @@ use app\admin\logic\tools\GeneratorLogic; use app\api\logic\order\OrderLogic as OrderOrderLogic; use app\common\logic\PayNotifyLogic; use app\common\logic\store_order\StoreOrderLogic; +use app\common\model\beforehand_order_record\BeforehandOrderRecord; use app\common\model\Config as ModelConfig; use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_finance_flow\StoreFinanceFlow; use app\common\model\store_order\StoreOrder; +use app\common\model\store_order_cart_info\StoreOrderCartInfo; use app\common\model\store_product\StoreProduct; use app\common\model\system_store\SystemStore; +use app\common\model\system_store_storage\SystemStoreStorage; use app\common\model\user\User; use app\common\model\warehouse_product\WarehouseProduct; +use app\common\service\Curl; use app\common\service\pay\PayService; use app\common\service\PushService; use app\common\service\wechat\WechatTemplate; @@ -44,10 +49,40 @@ use PhpOffice\PhpWord\Style\Font; class IndexController extends BaseApiController { - public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street', 'village', 'brigade', 'config', 'push']; + public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street', 'village', 'brigade', 'config', 'push', 'view_beforehand_order_record', 'view_beforehand_order_record_enter']; public function index() { + d(1); + + $arr=StoreOrder::where('store_id',8)->where('paid',1)->field('id,pay_price')->select()->toArray(); + $data=[]; + foreach ($arr as $k => $v) { + $total_price=StoreOrderCartInfo::where('oid', $v['id'])->sum('total_price'); + if($total_price != $v['pay_price']){ + $s=$v; + $s['total_price']=$total_price; + $data[] = $s; + } + } + d($data); + + + $url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=b538e44b-940b-445f-afe0-97320942d959'; + + $arr = ["msgtype" => "template_card", "template_card" => [ + 'card_type' => 'text_notice', + 'main_title' => [ + 'title' => '测试标题', + 'desc' => '分单' + ], + 'card_action' => [ + 'type' => 1, + 'url' => 'https://admin-multi-store.lihaink.cn/admin' + ] + ]]; + $a = (new Curl())->postJson($url, json_encode($arr, true)); + d($a); return json(1); $financeFlow = new StoreFinanceFlow(); @@ -181,4 +216,56 @@ class IndexController extends BaseApiController $a = PushService::push($name, $uid, ['type' => $type, 'msg' => '支付超时,订单已被取消,请重新提交订单', 'data' => ['id' => 5]]); return $this->success('ok', ['data' => $a]); } + + public function view_beforehand_order_record() + { + $id = $this->request->get('id'); + $is_xlsx = $this->request->get('is_xlsx'); + if ($is_xlsx == 1) { + $xlsx_name = '清单'; + } elseif ($is_xlsx == 2) { + $xlsx_name = '分单'; + } elseif ($is_xlsx == 3) { + $xlsx_name = '采购'; + } elseif ($is_xlsx == 4) { + $xlsx_name = '出库'; + } + return view('beforehand_order/record', ['id' => $id, 'is_xlsx' => $is_xlsx, 'xlsx_name' => $xlsx_name]); + } + public function view_beforehand_order_record_enter() + { + $id = $this->request->post('id'); + $check = $this->request->post('check'); + $is_xlsx = $this->request->post('is_xlsx', 0); + if ($is_xlsx) { + if ($is_xlsx == 1) { + $file_path = BeforehandOrderLogic::OrderList(['id' => $id]); + return $this->success('导出成功', ['url' => $file_path]); + } elseif ($is_xlsx == 2) { + $file_path = BeforehandOrderLogic::OrderAllocation(['id' => $id]); + return $this->success('导出成功', ['url' => $file_path]); + } elseif ($is_xlsx == 3) { + $file_path = BeforehandOrderLogic::OrderInfo(['id' => $id]); + return $this->success('导出成功', ['url' => $file_path]); + } elseif ($is_xlsx == 4) { + $file_path = BeforehandOrderLogic::OrderOutbound(['id' => $id]); + return $this->success('导出成功', ['url' => $file_path]); + } else { + return $this->fail('导出失败'); + } + } + $check_id = 0; + if ($check == '001') { + $check_id = 14; + } + if ($check == '002') { + $check_id = 6; + } + $res = BeforehandOrderRecord::where(['id' => $id])->update(['check_user_id' => $check_id, 'status' => 1]); + if ($res) { + return $this->success('审核通过'); + } else { + return $this->fail('审核失败'); + } + } }