request->post(); Log::info('dy_testNotify:'.json_encode($params)); } public function getClientToken() { $access_token = DouYinService::getClientToken($this->request->get()['isRefresh']??false); return $this->success('',['access_token'=>$access_token]); } /** * 手机号注册 * @author liugc <466014217@qq.com> * @date 2025/5/20 13:39 */ public function register() { try { $params = $this->request->post(); $this->validate($params,[ "code" => "require", "mobile" => "require|mobile", ]); // 验证码验证 $res = \app\workerapi\logic\LoginLogic::confirmMobile($params); if(!$res){ throw new \Exception('验证码错误'); } // 注册并登录 $result = DouYinService::phoneLogin($params); return $this->data($result); } catch (\Exception $e) { return $this->fail($e->getMessage()); } } /** * @notes 账号密码/手机号密码/手机号验证码登录 * @return \think\response\Json * @author 段誉 * @date 2022/9/16 10:42 */ public function account() { try { $params = (new LoginAccountValidate())->post()->goCheck(); $result = LoginLogic::login($params); if (false === $result) { return $this->fail(LoginLogic::getError()); } return $this->data($result); } catch (\Exception $e) { return $this->fail($e->getMessage()); } } /** * @notes 退出登录 * @return \think\response\Json * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author 段誉 * @date 2022/9/16 10:42 */ public function logout() { LoginLogic::logout($this->userInfo); return $this->success(); } /** * 所有商品 * @return \think\response\Json * @author liugc <466014217@qq.com> * @date 2025/5/20 14:35 */ public function getAllGoods() { $params = $this->request->get(); $params['platform_value'] = 6; return $this->dataLists((new GoodsLists())->setParams($params)); } /** * 商品详情 * @return \think\response\Json * @author liugc <466014217@qq.com> * @date 2025/5/20 14:35 */ public function getGoodsDetail() { $params = $this->request->get(); $params['platform_value'] = 6; $result = GoodsLogic::detail($params['goods_category_id'],'category',$this->userId,$params); return $this->data($result); } /** * 下单 * @return \think\response\Json * @author liugc <466014217@qq.com> * @date 2025/5/22 14:35 */ /*public function submitOrder() { try { $params = $this->request->post(); $params['user_id'] = $this->userId; $params['user_info'] = $this->userInfo; $order_number = DouYinService::submitOrder($params); $requestOrderData = DouYinService::getByteAuthorization($order_number); $requestOrderData['order_number'] = $order_number; return $this->success('',$requestOrderData); } catch (\Exception $e) { return $this->fail($e->getMessage()); } }*/ public function submitOrderNotify() { try { $params = $this->request->post(); $msg = is_array($params['msg'])?$params['msg']:json_decode($params['msg'],true); $msg['user_id'] = $this->userId; $msg['user_info'] = $this->userInfo; $res = DouYinService::submitOrderNotify($msg); if($res){ return json(["err_no"=>0,"err_tips"=>"success","data"=>$res], 200); } } catch (\Exception $e) { return json(["err_no"=>1001,"err_tips"=>$e->getMessage()], 200); } } /** * 拉起支付所需参数 * @return \think\response\Json * @author liugc <466014217@qq.com> * @date 2025/5/22 14:35 */ public function requestOrderData() { try { $params = $this->request->post(); $params['user_id'] = $this->userId; $params['user_info'] = $this->userInfo; $requestOrderData = DouYinService::getByteAuthorization($params['order_number']); $requestOrderData['order_number'] = $params['order_number']; return $this->success('',$requestOrderData); } catch (\Exception $e) { return $this->fail($e->getMessage()); } } /** * 取消订单 * @return \think\response\Json * @author liugc <466014217@qq.com> * @date 2025/5/22 14:35 */ public function cancelOrder() { try { $params = $this->request->post(); // order_number DouYinService::cancelOrder($params); return $this->success(); } catch (\Exception $e) { return $this->fail($e->getMessage()); } } /** * 支付回调 * @return \think\response\Json * @author liugc <466014217@qq.com> * @date 2025/5/22 14:35 */ public function payNotify() { try { $params = $this->request->post(); $msg = is_array($params['msg'])?$params['msg']:json_decode($params['msg'],true); if(DouYinService::payNotify($msg)){ return json(["err_no"=>0,"err_tips"=>"success"], 200); } } catch (\Exception $e) { return json(["err_no"=>1001,"err_tips"=>$e->getMessage()], 200); } } /** * 预约 * @return \think\response\Json * @author liugc <466014217@qq.com> * @date 2025/5/22 14:35 */ public function reservation() { try { $params = $this->request->post(); // order_number DouYinService::reservation($params); return $this->success(); } catch (\Exception $e) { return $this->fail($e->getMessage()); } } /** * 修改预约 * @return \think\response\Json * @author liugc <466014217@qq.com> * @date 2025/5/22 14:35 */ public function upReservation() { try { $params = $this->request->post(); // order_number appointment_time DouYinService::upReservation($params); return $this->success(); } catch (\Exception $e) { return $this->fail($e->getMessage()); } } /** * 订单列表 * @return \think\response\Json * @author liugc <466014217@qq.com> * @date 2025/5/22 14:35 */ public function getOrderLists() { $params = $this->request->get(); $params['user_id'] = $this->userId; return $this->dataLists((new DouyinOrderLists())->setParams($params)); } public function getOrderDetail() { $params = $this->request->get(); $params['user_id'] = $this->userId; $result = DouYinService::getOrderDetail($params); return $this->data($result); } /** * 退款 * @return \think\response\Json * @author liugc <466014217@qq.com> * @date 2025/5/22 14:35 */ public function refund() { try { $params = $this->request->post(); // order_number appointment_time $params['user_id'] = $this->userId; DouYinService::refund($params); return $this->success(); } catch (\Exception $e) { return $this->fail($e->getMessage()); } } /** * 退款订单列表 * @return \think\response\Json * @author liugc <466014217@qq.com> * @date 2025/5/22 14:35 */ public function getRefundLists() { $params = $this->request->get(); $params['user_id'] = $this->userId; return $this->dataLists((new DouyinRefundOrderLists())->setParams($params)); } /** * 退款回调 * @author liugc <466014217@qq.com> * @date 2025/5/22 14:35 */ public function refundNotify() { try { $params = $this->request->post(); $msg = is_array($params['msg'])?$params['msg']:json_decode($params['msg'],true); if(DouYinService::refundNotify($msg)){ return json(["err_no"=>0,"err_tips"=>"success"], 200); } } catch (\Exception $e) { return json(["err_no"=>1001,"err_tips"=>$e->getMessage()], 200); } } }