From b1ac5e95e05ff34c11ff1a3c9d5c12be64b953b9 Mon Sep 17 00:00:00 2001 From: wh <382379437@qq.com> Date: Thu, 8 Aug 2024 00:26:29 +0800 Subject: [PATCH] fixed --- digital_doctor/public/api_docs/api_list.html | 180 +++++++++----- digital_doctor/public/api_docs/api_list.md | 106 ++++---- .../general-utility-tools-php/.gitignore | 1 + .../src/algorithm/Algorithm.php | 121 ++++++++++ .../src/algorithm/AlgorithmTest.php | 52 ++++ .../src/algorithm/README.MD | 1 + .../src/alibaba/AlibabaAuth.php | 2 + .../src/alibaba/distributes/Testexample.php | 14 ++ .../distributes/alibabanotify/Alibaba.php | 127 ++++++++++ .../alibabanotify/BaseAlibabaLogic.php | 18 ++ .../alibabanotify/LogisticsNotify.php | 35 +++ .../distributes/alibabanotify/OrderNotify.php | 137 +++++++++++ .../alibabanotify/ProductNotify.php | 89 +++++++ .../distributes/alibabanotify/README.MD | 18 ++ .../distributes/strict/StrictOrder.php | 174 +++++++++++++- .../alibaba/distributes/strict/StrictPay.php | 30 +++ .../distributes/strict/StrictRefund.php | 227 ++++++++++++++++++ .../general-utility-tools-php/src/tool/Ip.php | 81 +++++-- 18 files changed, 1286 insertions(+), 127 deletions(-) create mode 100644 digital_doctor/vendor/wanghua/general-utility-tools-php/src/algorithm/Algorithm.php create mode 100644 digital_doctor/vendor/wanghua/general-utility-tools-php/src/algorithm/AlgorithmTest.php create mode 100644 digital_doctor/vendor/wanghua/general-utility-tools-php/src/algorithm/README.MD create mode 100644 digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/Alibaba.php create mode 100644 digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/BaseAlibabaLogic.php create mode 100644 digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/LogisticsNotify.php create mode 100644 digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/OrderNotify.php create mode 100644 digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/ProductNotify.php create mode 100644 digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/README.MD create mode 100644 digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/strict/StrictRefund.php diff --git a/digital_doctor/public/api_docs/api_list.html b/digital_doctor/public/api_docs/api_list.html index 58ef149..61463f6 100644 --- a/digital_doctor/public/api_docs/api_list.html +++ b/digital_doctor/public/api_docs/api_list.html @@ -324,6 +324,103 @@
+
+
+*** +``` + /** + * desc: 删除科室问卷答案 + * author:wh + * + * 参数: + * id 数据id 必须 + * api/Hdrquestionnaireanswer/del + * api/hdrquestionnaireanswer/del + */ +``` +
+
+ 按需填写其它接口参数: + + 测试 +
+
+ +
+
+*** +``` + /** + * 新增科室问卷问题(一个问题对应多个答案) + * + * 参数: + * hdrdepartment_id 所属科室 所属科室 必须 + * question 问卷问题 问卷问题 必须 + * is_common 是否通用:yes=是,no=否 是否通用:yes=是,no=否 必须 + * is_only_boy 只适合男:yes=是,no=否 只适合男:yes=是,no=否 必须 + * is_only_girl 只适合女:yes=是,no=否 只适合女:yes=是,no=否 必须 + * type 选项类型:one=单选,more=多选 选项类型:one=单选,more=多选 必须 + * api/Hdrquestionnairequestion/addHdrquestionnairequestion + * api/hdrquestionnairequestion/addHdrquestionnairequestion + */ +``` +
+
+ 按需填写其它接口参数: + + 测试 +
+
+ +
+
+*** +``` + /** + * 修改科室问卷问题(一个问题对应多个答案) + * 参数: + * id ID ID 必须 + * hdrdepartment_id 所属科室 + * question 问卷问题 + * is_common 是否通用:yes=是,no=否 + * is_only_boy 只适合男:yes=是,no=否 + * is_only_girl 只适合女:yes=是,no=否 + * type 选项类型:one=单选,more=多选 + * api/Hdrquestionnairequestion/updateHdrquestionnairequestion + * api/hdrquestionnairequestion/updateHdrquestionnairequestion + */ +``` +
+
+ 按需填写其它接口参数: + + 测试 +
+
+ +
+
+*** +``` + /** + * desc: 删除科室问卷问题(一个问题对应多个答案) + * author:wh + * + * 参数: + * id 数据id 必须 + * + * api/Hdrquestionnairequestion/del + * api/hdrquestionnairequestion/del + */ +``` +
+
+ 按需填写其它接口参数: + + 测试 +
+
+
*** @@ -337,14 +434,9 @@ * 带分页 * current_page 当前页码 * list_rows 每页显示条数 默认15 - * question 问卷问题 - * id ID - * hdrdepartment_id 所属科室 - * question 问卷问题 - * is_common 是否通用:yes=是,no=否 - * is_only_boy 只适合男:yes=是,no=否 - * is_only_girl 只适合女:yes=是,no=否 - * type 选项类型:one=单选,more=多选 + * id ID + * hdrdepartment_id 所属科室 + * question 问卷问题 * * 所有字段说明(可能有部分额外字段未在此体现): * id ID @@ -369,58 +461,6 @@
-
-
-*** -``` - /** - * 新增科室问卷问题(一个问题对应多个答案) - * - * 参数: - * hdrdepartment_id 所属科室 所属科室 必须 - * question 问卷问题 问卷问题 必须 - * is_common 是否通用:yes=是,no=否 是否通用:yes=是,no=否 必须 - * is_only_boy 只适合男:yes=是,no=否 只适合男:yes=是,no=否 必须 - * is_only_girl 只适合女:yes=是,no=否 只适合女:yes=是,no=否 必须 - * type 选项类型:one=单选,more=多选 选项类型:one=单选,more=多选 必须 - * api/Hdrquestionnairequestion/addHdrquestionnairequestion - * api/hdrquestionnairequestion/addHdrquestionnairequestion - */ -``` -
-
- 按需填写其它接口参数: - - 测试 -
-
- -
-
-*** -``` - /** - * 修改科室问卷问题(一个问题对应多个答案) - * 参数: - * id ID ID 必须 - * hdrdepartment_id 所属科室 - * question 问卷问题 - * is_common 是否通用:yes=是,no=否 - * is_only_boy 只适合男:yes=是,no=否 - * is_only_girl 只适合女:yes=是,no=否 - * type 选项类型:one=单选,more=多选 - * api/Hdrquestionnairequestion/updateHdrquestionnairequestion - * api/hdrquestionnairequestion/updateHdrquestionnairequestion - */ -``` -
-
- 按需填写其它接口参数: - - 测试 -
-
-
*** @@ -1322,11 +1362,11 @@ $('.api_hdrquestionnaireanswer_updateHdrquestionnaireanswer_response_result').html(JSON.stringify(res, null, "\t")); $('.api_hdrquestionnaireanswer_updateHdrquestionnaireanswer_response_result').attr('style','color:green'); },'json'); - }, api_hdrquestionnairequestion_getHdrquestionnairequestionList(){ - let url = $('#api_hdrquestionnairequestion_getHdrquestionnairequestionList_textarea').val(); + }, api_hdrquestionnaireanswer_del(){ + let url = $('#api_hdrquestionnaireanswer_del_textarea').val(); $.post(url,{},function(res) { - $('.api_hdrquestionnairequestion_getHdrquestionnairequestionList_response_result').html(JSON.stringify(res, null, "\t")); - $('.api_hdrquestionnairequestion_getHdrquestionnairequestionList_response_result').attr('style','color:green'); + $('.api_hdrquestionnaireanswer_del_response_result').html(JSON.stringify(res, null, "\t")); + $('.api_hdrquestionnaireanswer_del_response_result').attr('style','color:green'); },'json'); }, api_hdrquestionnairequestion_addHdrquestionnairequestion(){ let url = $('#api_hdrquestionnairequestion_addHdrquestionnairequestion_textarea').val(); @@ -1340,6 +1380,18 @@ $('.api_hdrquestionnairequestion_updateHdrquestionnairequestion_response_result').html(JSON.stringify(res, null, "\t")); $('.api_hdrquestionnairequestion_updateHdrquestionnairequestion_response_result').attr('style','color:green'); },'json'); + }, api_hdrquestionnairequestion_del(){ + let url = $('#api_hdrquestionnairequestion_del_textarea').val(); + $.post(url,{},function(res) { + $('.api_hdrquestionnairequestion_del_response_result').html(JSON.stringify(res, null, "\t")); + $('.api_hdrquestionnairequestion_del_response_result').attr('style','color:green'); + },'json'); + }, api_hdrquestionnairequestion_getHdrquestionnairequestionList(){ + let url = $('#api_hdrquestionnairequestion_getHdrquestionnairequestionList_textarea').val(); + $.post(url,{},function(res) { + $('.api_hdrquestionnairequestion_getHdrquestionnairequestionList_response_result').html(JSON.stringify(res, null, "\t")); + $('.api_hdrquestionnairequestion_getHdrquestionnairequestionList_response_result').attr('style','color:green'); + },'json'); }, api_hdrregister_addHdrregister(){ let url = $('#api_hdrregister_addHdrregister_textarea').val(); $.post(url,{},function(res) { diff --git a/digital_doctor/public/api_docs/api_list.md b/digital_doctor/public/api_docs/api_list.md index 6f339a0..b8c4f69 100644 --- a/digital_doctor/public/api_docs/api_list.md +++ b/digital_doctor/public/api_docs/api_list.md @@ -223,6 +223,67 @@ */ ``` +*** +``` + /** + * desc: 删除科室问卷答案 + * author:wh + * + * 参数: + * id 数据id 必须 + * api/Hdrquestionnaireanswer/del + * api/hdrquestionnaireanswer/del + */ +``` + +*** +``` + /** + * 新增科室问卷问题(一个问题对应多个答案) + * + * 参数: + * hdrdepartment_id 所属科室 所属科室 必须 + * question 问卷问题 问卷问题 必须 + * is_common 是否通用:yes=是,no=否 是否通用:yes=是,no=否 必须 + * is_only_boy 只适合男:yes=是,no=否 只适合男:yes=是,no=否 必须 + * is_only_girl 只适合女:yes=是,no=否 只适合女:yes=是,no=否 必须 + * type 选项类型:one=单选,more=多选 选项类型:one=单选,more=多选 必须 + * api/Hdrquestionnairequestion/addHdrquestionnairequestion + * api/hdrquestionnairequestion/addHdrquestionnairequestion + */ +``` + +*** +``` + /** + * 修改科室问卷问题(一个问题对应多个答案) + * 参数: + * id ID ID 必须 + * hdrdepartment_id 所属科室 + * question 问卷问题 + * is_common 是否通用:yes=是,no=否 + * is_only_boy 只适合男:yes=是,no=否 + * is_only_girl 只适合女:yes=是,no=否 + * type 选项类型:one=单选,more=多选 + * api/Hdrquestionnairequestion/updateHdrquestionnairequestion + * api/hdrquestionnairequestion/updateHdrquestionnairequestion + */ +``` + +*** +``` + /** + * desc: 删除科室问卷问题(一个问题对应多个答案) + * author:wh + * + * 参数: + * id 数据id 必须 + * + * api/Hdrquestionnairequestion/del + * api/hdrquestionnairequestion/del + */ +``` + *** ``` /** @@ -234,14 +295,9 @@ * 带分页 * current_page 当前页码 * list_rows 每页显示条数 默认15 - * question 问卷问题 - * id ID - * hdrdepartment_id 所属科室 - * question 问卷问题 - * is_common 是否通用:yes=是,no=否 - * is_only_boy 只适合男:yes=是,no=否 - * is_only_girl 只适合女:yes=是,no=否 - * type 选项类型:one=单选,more=多选 + * id ID + * hdrdepartment_id 所属科室 + * question 问卷问题 * * 所有字段说明(可能有部分额外字段未在此体现): * id ID @@ -259,40 +315,6 @@ */ ``` -*** -``` - /** - * 新增科室问卷问题(一个问题对应多个答案) - * - * 参数: - * hdrdepartment_id 所属科室 所属科室 必须 - * question 问卷问题 问卷问题 必须 - * is_common 是否通用:yes=是,no=否 是否通用:yes=是,no=否 必须 - * is_only_boy 只适合男:yes=是,no=否 只适合男:yes=是,no=否 必须 - * is_only_girl 只适合女:yes=是,no=否 只适合女:yes=是,no=否 必须 - * type 选项类型:one=单选,more=多选 选项类型:one=单选,more=多选 必须 - * api/Hdrquestionnairequestion/addHdrquestionnairequestion - * api/hdrquestionnairequestion/addHdrquestionnairequestion - */ -``` - -*** -``` - /** - * 修改科室问卷问题(一个问题对应多个答案) - * 参数: - * id ID ID 必须 - * hdrdepartment_id 所属科室 - * question 问卷问题 - * is_common 是否通用:yes=是,no=否 - * is_only_boy 只适合男:yes=是,no=否 - * is_only_girl 只适合女:yes=是,no=否 - * type 选项类型:one=单选,more=多选 - * api/Hdrquestionnairequestion/updateHdrquestionnairequestion - * api/hdrquestionnairequestion/updateHdrquestionnairequestion - */ -``` - *** ``` /** diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/.gitignore b/digital_doctor/vendor/wanghua/general-utility-tools-php/.gitignore index a5a8472..e76292a 100644 --- a/digital_doctor/vendor/wanghua/general-utility-tools-php/.gitignore +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/.gitignore @@ -4,3 +4,4 @@ /.git /.idea /composer.lock +.git* diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/algorithm/Algorithm.php b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/algorithm/Algorithm.php new file mode 100644 index 0000000..493b70a --- /dev/null +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/algorithm/Algorithm.php @@ -0,0 +1,121 @@ + $weight) { + $cumulativeWeight += $weight; // 累加权重 + if ($random <= $cumulativeWeight) { + $selected = $index; // 根据权重选择索引 + break; + } + } + //输出选择的索引 + return $selected; + } + + /** + * desc:测试权重随机算法概率 + * author:wh + * @param array $weights 权重数组 eg:[1, 9, 30, 70] + */ + static function testWeightRandom(array $weights){ + echo json_encode($weights)."\n"; + + $trials = 1000; // 试验次数 + $selectionCounts = array_fill(0, count($weights), 0); // 用于存储每个索引的选择次数 + + for ($i = 0; $i < $trials; $i++) { + + $index = self::weightRandom($weights); + $selectionCounts[$index]++; // 记录选择次数 + } + + // 计算每个索引的选择概率 + $probabilities = []; + foreach ($selectionCounts as $index => $count) { + $probabilities[$index] = ($count / $trials) * 100; // 转换为百分比 + } + + // 输出结果 + echo "After {$trials} trials, the probabilities of selecting each index are:\n"; + foreach ($probabilities as $index => $probability) { + echo "Index {$index}: {$probability}%\n"; + } + } + + /** + * desc:洗牌算法 + * + * 对数组进行随机排序,实现洗牌算法 + * author:wh + * @param array $items eg: [1, 2, 3, 4, 5] + * @return array 返回计算后的数组 + */ + static function shuffle(array $items) { + //$items = [1, 2, 3, 4, 5]; + shuffle($items); + return $items; + } + + /** + * 随机密码生成算法 + * + * 作用:创建安全的随机密码,常用于用户注册或密码重置 + * 使用场景:用户账户创建、密码重置链接生成 + */ + static function randomPassword($length = 8) { + $password = ''; + $possibleChars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + + for ($i = 0; $i < $length; $i++) { + $password .= substr($possibleChars, mt_rand(0, strlen($possibleChars) - 1), 1); + } + return $password; + } + + /** + * 随机颜色生成算法 + * + * 作用:生成随机RGB颜色值,可用于网页设计中动态改变元素颜色 + * 使用场景:动态网页背景、随机颜色显示的元素 + */ + static function randomColor() { + $red = mt_rand(0, 255); + $green = mt_rand(0, 255); + $blue = mt_rand(0, 255); + return [$red, $green, $blue]; + } +} \ No newline at end of file diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/algorithm/AlgorithmTest.php b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/algorithm/AlgorithmTest.php new file mode 100644 index 0000000..9c61338 --- /dev/null +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/algorithm/AlgorithmTest.php @@ -0,0 +1,52 @@ + $count) { + $probabilities[$index] = ($count / $trials) * 100; // 转换为百分比 + } + + // 输出结果 + echo "After {$trials} trials, the probabilities of selecting each index are:\n"; + foreach ($probabilities as $index => $probability) { + echo "Index {$index}: {$probability}%\n"; + } + } + + +} \ No newline at end of file diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/algorithm/README.MD b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/algorithm/README.MD new file mode 100644 index 0000000..2411941 --- /dev/null +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/algorithm/README.MD @@ -0,0 +1 @@ +## 常见实用算法 \ No newline at end of file diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/AlibabaAuth.php b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/AlibabaAuth.php index abb5144..67f760a 100644 --- a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/AlibabaAuth.php +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/AlibabaAuth.php @@ -25,6 +25,7 @@ class AlibabaAuth { public $base_url = '';//不同业务线,授权地址不一样 public $config = []; + public $request_body = []; public function __construct($config) { $this->config = $config; @@ -154,6 +155,7 @@ class AlibabaAuth $url = $this->base_url.$urlPath.'?'.$request_params_str.'&access_token='.$accessToken.'&_aop_signature='.$_aop_signature; //dump($url); + $this->request_body = $url; $res = Curl::curl_post($url,[]); return $res; } diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/Testexample.php b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/Testexample.php index bc6cdce..6eddd6a 100644 --- a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/Testexample.php +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/Testexample.php @@ -133,6 +133,20 @@ class Testexample $order->setGoods($goods,$order_info['buy_num']); return $order->previewOrder(); } + //查询订单可以支持的支付渠道 + function queryOrderPayChannel($order_id){ + $config = config('meebo_supply_config'); + $authObj = new AlibabaAuth($config); + $order = new StrictPay($authObj); + return $order->queryOrderPayChannel($order_id); + } + //组合收银台url获取 + function getPayUrl(array $orderIds){ + $config = config('meebo_supply_config'); + $authObj = new AlibabaAuth($config); + $order = new StrictPay($authObj); + return $order->getPayUrl($orderIds,'PC'); + } //获取唤起旺旺聊天的链接 function getCustomerServiceLink($toOpenUid){ diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/Alibaba.php b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/Alibaba.php new file mode 100644 index 0000000..dadda46 --- /dev/null +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/Alibaba.php @@ -0,0 +1,127 @@ +$message_data]); + if(empty($message_data['type'])){ + return Tools::set_fail('type为空'); + } + //$key = strtolower(explode('_',$message_data['type'])[0]); + //获取消息类型 + $fn = strtolower($message_data['type']);//类型即为方法名 + //消息类型前缀即为类名 + $class = '\\app\\index\\logic\\alibabanotify\\'.ucfirst(explode('_',$fn)[0]).'Notify'; + //实例化类 + return (new $class())->{$fn}($message_data);//调用方法 + }); + } + + /** + * desc:ali采购获取临时授权code + * + * index/alibaba/webAuthCode + * + * author:wh + * @return string + */ + function webAuthCode(){ + + $Testexample = new Testexample(); + + $res = $Testexample->testWebAuth(request()->domain().'/index/alibaba/webUserAuth'); + return $res; + } + + /** + * desc:网页授权,code换取token + * + * index/alibaba/webUserAuth + * + * author:wh + */ + function webUserAuth(){ + $code = input('code'); + if(empty($code)){ + return $this->error('授权失败'); + } + + $redirect_uri = url('test/test2'); + $Testexample = new Testexample(); + $res = $Testexample->getTokenByCode($code,$redirect_uri); + if($res['code'] != 200){ + return $this->error('授权失败.'.$res['msg']); + } + $data = json_decode($res['data']); + $auth_data = [ + 'access_token'=>$data['access_token'], + 'aliid'=>$data['aliId'], + 'expires_in'=>$data['expires_in'], + 'memberid'=>$data['memberId'], + 'refresh_token'=>$data['refresh_token'], + 'refresh_token_timeout'=>$data['refresh_token_timeout'], + 'resource_owner'=>$data['resource_owner'], + ]; + //写入数据库 + Mmodel::existsUpdateInsert(TabConf::$fa_alibaba_user_auth,['access_token'=>$data['access_token']],$auth_data); + return '授权成功'; + } + + //function getCode(){ + // return Mmodel::catchJson(function (){ + // //保存code + // $code = input('code'); + // + // }); + //} +} \ No newline at end of file diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/BaseAlibabaLogic.php b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/BaseAlibabaLogic.php new file mode 100644 index 0000000..78b33b8 --- /dev/null +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/BaseAlibabaLogic.php @@ -0,0 +1,18 @@ +$message_data]); + + }); + } + /** + * 物流单号修改消息 + */ + function logistics_mail_no_change($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } +} \ No newline at end of file diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/OrderNotify.php b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/OrderNotify.php new file mode 100644 index 0000000..efb03e6 --- /dev/null +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/OrderNotify.php @@ -0,0 +1,137 @@ +$message_data]); + + }); + } + + /** + * desc:1688交易成功(卖家视角) + * author:wh + */ + function order_buyer_view_order_success($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688订单批量支付状态同步消息 + */ + function order_batch_pay($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688交易付款(买家视角)/1688 transaction payment (buyer view) + */ + function order_buyer_view_order_pay($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688卖家关闭订单(买家视角)/seller closing order (buyer view) + */ + function order_buyer_view_order_seller_close($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688修改订单价格(买家视角)/order price modification (buyer view) + */ + function order_buyer_view_order_price_modify($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688订单发货(买家视角)/1688 order delivery (buyer view) + */ + function order_buyer_view_announce_sendgoods($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688订单部分发货(买家视角)/Partial delivery of 1688 order (buyer view) + */ + function order_buyer_view_part_part_sendgoods($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 商家修改订单地址(买家视角) + */ + function order_buyer_view_order_seller_modify_adress($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688订单售中退款(买家视角) + */ + function order_buyer_view_order_buyer_refund_in_sales($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688订单售后退款(买家视角) + */ + function order_buyer_view_order_refund_after_sales($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688买家关闭订单(买家视角)/buyer closing order (buyer view) + */ + function order_buyer_view_order_buyer_close($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688订单确认收货(买家视角)/order receipt confirmation (buyer view) + */ + function order_buyer_view_order_comfirm_receivegoods($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } +} \ No newline at end of file diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/ProductNotify.php b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/ProductNotify.php new file mode 100644 index 0000000..8524216 --- /dev/null +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/ProductNotify.php @@ -0,0 +1,89 @@ +$message_data]); + + }); + } + /** + * 1688产品删除(关系用户视角) + */ + function product_relation_view_product_delete($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688产品新增或修改(关系用户视角) + */ + function product_relation_view_product_new_or_modify($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688产品上架(关系用户视角) + */ + function product_relation_view_product_repost($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688商品库存变更消息(关系用户视角) + */ + function product_product_inventory_change($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 精选货源商品下架消息 + */ + function product_pft_offer_quit($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 精选货源商品价格变动消息 + */ + function product_pft_offer_price_modify($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } + /** + * 1688产品下架(关系用户视角) + */ + function product_relation_view_product_expire($message_data){ + return Mmodel::catch(function ()use($message_data){ + Tools::log_to_write_txt([__FUNCTION__.'消息入参:'=>$message_data]); + + }); + } +} \ No newline at end of file diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/README.MD b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/README.MD new file mode 100644 index 0000000..ef4338e --- /dev/null +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/alibabanotify/README.MD @@ -0,0 +1,18 @@ +## 阿里巴巴开放平台消息通知模板 + + +### 特别说明 +#### Alibaba.php是控制器类(复制可用),是消息通道httpCallback的回调地址类文件。 +##### eg:http://www.xxx.com/index/alibaba/notify +##### 回调地址配置入口:https://open.1688.com/develop/app/detail?spm=a260s.develop-app-list.0.0.4d875bfaS5YzoD&appkey=7571564&appKey=7571564 +进入页面后找到“日常消息测试”按钮,点击后在弹出的界面中进行配置。 +### 文件说明 +#### 按照消息类型前缀分类(复制可用) +1. 订单相关 OrderNotify.php +2. 产品相关 ProductNotify.php +3. 物流相关 LogisticsNotify.php +4. 售后相关 + +......以此类推,消息类型的小写就是类的方法名。 + +这里只是打个样,这几个模板可以直接复制,补充上自己的业务逻辑即可。 \ No newline at end of file diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/strict/StrictOrder.php b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/strict/StrictOrder.php index cb62376..cc46d96 100644 --- a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/strict/StrictOrder.php +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/strict/StrictOrder.php @@ -26,7 +26,7 @@ class StrictOrder extends BaseStrict //发票信息 private $invoice = []; //交易类型 由于不同的商品支持的交易方式不同,没有一种交易方式是全局通用的,所以当前下单可使用的交易方式必须通过下单预览接口的tradeModeNameList获取。 - private $tradeType = ''; + public $tradeType = ''; /** * desc:收货地址说明 @@ -68,10 +68,27 @@ class StrictOrder extends BaseStrict function setGoods($goods,$buy_num){ $this->goods = [ 'offerId'=>$goods['offerid'], - 'specId'=>$goods['specid'],//商品规格id 'quantity'=>$buy_num,//$goods['quantity'],//商品数量(计算金额用) - ]; + if(!empty($goods['specid'])){ + $this->goods['specId'] = $goods['specid'];//商品规格id + } + } + + /** + * desc:设置发票信息 + * author:wh + */ + function setInvoice(array $invoice){ + $this->invoice = $invoice; + } + + /** + * desc:设置发票信息 + * author:wh + */ + function setInvoice(array $invoice){ + $this->invoice = $invoice; } /** * desc:创建分销订单 @@ -95,6 +112,8 @@ class StrictOrder extends BaseStrict if(empty($this->tradeType)){ throw new Exception('交易类型必须'); } + //由于不同的商品支持的交易方式不同,没有一种交易方式是全局通用的, + //所以当前下单可使用的交易方式必须通过下单预览接口的tradeModeNameList获取。 $request_data = ['tradeType'=>$this->tradeType]; //boutiquefenxiao(新分销严选) @@ -247,4 +266,153 @@ class StrictOrder extends BaseStrict return $res; } + /** + * 订单列表查看(买家视角) + * https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.trade:alibaba.trade.getBuyerOrderList-1&aopApiCategory=trade_new + * + */ + function getOrderList($queryParams=[],$page=1,$pageSize=20){ + $urlPath = "param2/1/com.alibaba.trade/alibaba.trade.getSellerOrderList/".$this->authObj->config['appkey']; + $request_data = []; + $request_data['page'] = $page; + $request_data['pageSize'] = $pageSize; + + //业务类型,支持: "cn"(普通订单类型), "ws"(大额批发订单类型), "yp"(普通拿样订单类型), "yf"(一分钱拿样订单类型), + // "fs"(倒批(限时折扣)订单类型), "cz"(加工定制订单类型), "ag"(协议采购订单类型), "hp"(伙拼订单类型), + // "gc"(国采订单类型), "supply"(供销订单类型), "nyg"(nyg订单类型), "factory"(淘工厂订单类型), + // "quick"(快订下单), "xiangpin"(享拼订单), "nest"(采购商城-鸟巢), "f2f"(当面付), "cyfw"(存样服务), + // "sp"(代销订单标记), "wg"(微供订单), "factorysamp"(淘工厂打样订单), "factorybig"(淘工厂大货订单) + if(isset($queryParams['bizTypes'])){ + $request_data['bizTypes'] = $queryParams['bizTypes']; + } + //下单开始时间 20180802211113000+0800 + if(isset($queryParams['createStartTime'])){ + $request_data['createStartTime'] = $queryParams['createStartTime']; + } + //下单结束时间 20180802211113000+0800 + if(isset($queryParams['createEndTime'])){ + $request_data['createEndTime'] = $queryParams['createEndTime']; + } + //是否查询历史订单表,默认查询当前表,即默认值为false + if(isset($queryParams['isHis'])){ + $request_data['isHis'] = $queryParams['isHis']; + } + //查询修改时间结束 20180802211113000+0800 + if(isset($queryParams['modifyStartTime'])){ + $request_data['modifyStartTime'] = $queryParams['modifyStartTime']; + } + //查询修改时间结束 20180802211113000+0800 + if(isset($queryParams['modifyEndTime'])){ + $request_data['modifyEndTime'] = $queryParams['modifyEndTime']; + } + //订单状态,值有 success, cancel(交易取消,违约金等交割完毕), waitbuyerpay(等待卖家付款), + // waitsellersend(等待卖家发货),waitbuyerreceive(等待买家收货 ) + if(isset($queryParams['orderStatus'])){ + $request_data['orderStatus'] = $queryParams['orderStatus']; + } + //查询分页页码,从1开始 + //if(isset($queryParams['page'])){ + // $request_data['page'] = $queryParams['page']; + //} + ////查询的每页的数量 20 + //if(isset($queryParams['pageSize'])){ + // $request_data['pageSize'] = $queryParams['pageSize']; + //} + //退款状态,支持: "waitselleragree"(等待卖家同意), "refundsuccess"(退款成功), "refundclose"(退款关闭), + // "waitbuyermodify"(待买家修改), "waitbuyersend"(等待买家退货), "waitsellerreceive"(等待卖家确认收货) + if(isset($queryParams['refundStatus'])){ + $request_data['refundStatus'] = $queryParams['refundStatus']; + } + //卖家memberId b2b-1624961198 + if(isset($queryParams['sellerMemberId'])){ + $request_data['sellerMemberId'] = $queryParams['sellerMemberId']; + } + //卖家loginId alitestforisv02 + if(isset($queryParams['sellerLoginId'])){ + $request_data['sellerLoginId'] = $queryParams['sellerLoginId']; + } + //卖家评价状态 (4:已评价,5:未评价,6;不需要评价) + if(isset($queryParams['sellerRateStatus'])){ + $request_data['sellerRateStatus'] = $queryParams['sellerRateStatus']; + } + //交易类型: 担保交易(1), 预存款交易(2), ETC境外收单交易(3), 即时到帐交易(4), 保障金安全交易(5), 统一交易流程(6), + // 分阶段交易(7), 货到付款交易(8), 信用凭证支付交易(9), 账期支付交易(10), 1688交易4.0,新分阶段交易(50060), + // 当面付的交易流程(50070), 服务类的交易流程(50080) + if(isset($queryParams['tradeType'])){ + $request_data['tradeType'] = $queryParams['tradeType']; + } + //商品名称 + if(isset($queryParams['productName'])){ + $request_data['productName'] = $queryParams['productName']; + } + //是否需要查询买家的详细地址信息和电话 false + if(isset($queryParams['needBuyerAddressAndPhone'])){ + $request_data['needBuyerAddressAndPhone'] = $queryParams['needBuyerAddressAndPhone']; + } + //是否需要查询备注信息 false + if(isset($queryParams['needMemoInfo'])){ + $request_data['needMemoInfo'] = $queryParams['needMemoInfo']; + } + //外部订单号,可用于控制幂等 90187872898371 + if(isset($queryParams['outOrderId'])){ + $request_data['outOrderId'] = $queryParams['outOrderId']; + } + + $res = $this->authObj->request($urlPath, $request_data); + return $res; + } + /** + * 订单详情查看(买家视角) + * https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.trade:alibaba.trade.get.buyerView-1&aopApiCategory=trade_new + */ + function getBuyerView(int $orderId,$webSite='1688',$includeFields='',$attributeKeys='',$outOrderId=''){ + $urlPath = "param2/1/com.alibaba.trade/alibaba.trade.get.buyerView/".$this->authObj->config['appkey']; + $request_data = []; + $request_data['orderId'] = $orderId;//交易的订单id 1234345 + $request_data['webSite'] = $webSite;//站点信息,指定调用的API是属于国际站(alibaba)还是1688网站(1688) + $request_data['includeFields'] = $includeFields;//查询结果中包含的域,GuaranteesTerms:保障条款,NativeLogistics:物流信息,RateDetail:评价详情,OrderInvoice:发票信息。默认返回GuaranteesTerms、NativeLogistics、OrderInvoice。 + $request_data['attributeKeys'] = $attributeKeys;//垂直表中的attributeKeys + $request_data['outOrderId'] = $outOrderId;//外部订单id,控制幂等 + $res = $this->authObj->request($urlPath, $request_data); + return $res; + } + + /** + * 获取交易订单的物流信息(买家视角) + * + * 该接口需要获得订单买家的授权,获取买家的订单的物流详情,在采购或者分销场景中,作为买家也有获取物流详情的需求。 + * 该接口能查能根据订单号查看物流详情,包括发件人,收件人,所发货物明细等。由于物流单录入的原因, + * 可能跟踪信息的API查询会有延迟。该API需要向开放平台申请权限才能访问。 + * + * https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.logistics:alibaba.trade.getLogisticsInfos.buyerView-1&aopApiCategory=Logistics_NEW + */ + function getLogisticsInfosBuyerView(int $orderId,$webSite='1688',$fields=''){ + $urlPath = "param2/1/com.alibaba.logistics/alibaba.trade.getLogisticsInfos.buyerView/".$this->authObj->config['appkey']; + $request_data = []; + $request_data['orderId'] = $orderId;//交易的订单id 1234345 + $request_data['webSite'] = $webSite;//站点信息,指定调用的API是属于国际站是1688业务还是icbu业务 (1688或者alibaba) + $request_data['fields'] = $fields;//需要返回的字段,目前有:company.name,sender,receiver,sendgood。返回的字段要用英文逗号分隔开 + $res = $this->authObj->request($urlPath, $request_data); + return $res; + } + /** + * 获取交易订单的物流跟踪信息(买家视角) + * + * 该接口需要获取订单买家的授权,获取买家的订单的物流跟踪信息,在采购或者分销场景中,作为买家也有获取物流详情的需求。 + * 该接口能查能根据物流单号查看物流单跟踪信息。由于物流单录入的原因,可能跟踪信息的API查询会有延迟。 + * 该API需要向开放平台申请权限才能访问。 + * + * https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.logistics:alibaba.trade.getLogisticsTraceInfo.buyerView-1&aopApiCategory=Logistics_NEW + */ + function getLogisticsTraceInfoBuyerView(int $orderId,$webSite='1688',$logisticsId=''){ + $urlPath = "param2/1/com.alibaba.logistics/alibaba.trade.getLogisticsTraceInfo.buyerView/".$this->authObj->config['appkey']; + $request_data = []; + $request_data['orderId'] = $orderId;//交易的订单id 1234345 + $request_data['webSite'] = $webSite;//站点信息,指定调用的API是属于国际站是1688业务还是ic + $request_data['logisticsId'] = $logisticsId;//该订单下的物流编号 AL8234243 + $res = $this->authObj->request($urlPath, $request_data); + return $res; + } + + } \ No newline at end of file diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/strict/StrictPay.php b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/strict/StrictPay.php index 3ede373..69f6742 100644 --- a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/strict/StrictPay.php +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/strict/StrictPay.php @@ -30,4 +30,34 @@ class StrictPay extends BaseStrict $res = $this->authObj->request($urlPath, $request_data); return $res; } + + + /** + * desc:查询订单可以支持的支付渠道 + * author:wh + * @param string $order_id + */ + function queryOrderPayChannel(string $order_id){ + $urlPath = "param2/1/com.alibaba.trade/alibaba.trade.payWay.query/".$this->authObj->config['appkey']; + $request_data = []; + $request_data['orderId'] = $order_id; + $res = $this->authObj->request($urlPath, $request_data); + return $res; + } + + /** + * desc:组合收银台url获取 + * author:wh + * @param string $orderIds 订单列表 格式参考 字符串格式的数组:["123456789","123456789"] + * @param string $payPlatformType PC或WIRELESS + * @return mixed + */ + function getPayUrl(string $orderIds,string $payPlatformType){ + $urlPath = "param2/1/com.alibaba.trade/alibaba.trade.grouppay.url.get/".$this->authObj->config['appkey']; + $request_data = []; + $request_data['orderIds'] = $orderIds;//json_encode($orderIds); + $request_data['payPlatformType'] = $payPlatformType;//PC或WIRELESS + $res = $this->authObj->request($urlPath, $request_data); + return $res; + } } \ No newline at end of file diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/strict/StrictRefund.php b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/strict/StrictRefund.php new file mode 100644 index 0000000..9f48081 --- /dev/null +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/strict/StrictRefund.php @@ -0,0 +1,227 @@ +authObj->config['appkey']; + $request_data = []; + + //主订单 + if(empty($params['orderId'])){ + return Tools::set_fail('orderId不能为空'); + } + $request_data['orderId'] = $params['orderId']; + //子订单 订单接口 productItems- subItemID 就是子订单ID, + // 卖家拒绝退款后无法重新申请,需要到1688后台退款单页面 修改退款协议 + if(empty($params['orderEntryIds'])){ + return Tools::set_fail('orderEntryIds不能为空'); + } + $request_data['orderEntryIds'] = $params['orderEntryIds']; + //退款/退款退货。只有已收到货,才可以选择退款退货 退款:"refund"; 退款退货:"returnRefund" + if(empty($params['disputeRequest'])){ + return Tools::set_fail('disputeRequest不能为空'); + } + $request_data['disputeRequest'] = $params['disputeRequest']; + //退款金额(单位:分)。不大于实际付款金额;等待卖家发货时,必须为商品的实际付款金额。 + if(empty($params['applyPayment'])){ + return Tools::set_fail('applyPayment不能为空'); + } + $request_data['applyPayment'] = $params['applyPayment']; + //退运费金额(单位:分)。 + if(empty($params['applyCarriage'])){ + return Tools::set_fail('applyCarriage不能为空'); + } + $request_data['applyCarriage'] = $params['applyCarriage']; + //退款原因id(从API getRefundReasonList获取) + if(empty($params['applyReasonId'])){ + return Tools::set_fail('applyReasonId不能为空'); + } + $request_data['applyReasonId'] = $params['applyReasonId']; + //退款申请理由,2-150字 + if(empty($params['description'])){ + return Tools::set_fail('description不能为空'); + } + $request_data['description'] = $params['description']; + //货物状态 售中等待卖家发货:"refundWaitSellerSend"; 售中等待买家收货:"refundWaitBuyerReceive"; + // 售中已收货(未确认完成交易):"refundBuyerReceived" 售后未收货:"aftersaleBuyerNotReceived"; + // 售后已收到货:"aftersaleBuyerReceived" + if(empty($params['goodsStatus'])){ + return Tools::set_fail('goodsStatus不能为空'); + } + $request_data['goodsStatus'] = $params['goodsStatus']; + //凭证图片URLs。1-5张,必须使用API uploadRefundVoucher返回的“图片域名/相对路径” + if(isset($params['vouchers'])){ + $request_data['vouchers'] = $params['vouchers']; + } + //子订单退款数量。仅在售中买家已收货(退款退货)时,可指定退货数量;默认,全部退货。[{"id":586683458996743215,"count":1}] + if(isset($params['orderEntryCountList'])){ + $request_data['orderEntryCountList'] = $params['orderEntryCountList']; + } + + $res = $this->authObj->request($urlPath, $request_data); + return $res; + } + + /** + * 查询退款退货原因(用于创建退款退货) + * https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.trade:alibaba.trade.getRefundReasonList-1 + */ + function getRefundReasonList(int $orderId,$orderEntryIds,$goodsStatus){ + $urlPath = "param2/1/com.alibaba.trade/alibaba.trade.getRefundReasonList/".$this->authObj->config['appkey']; + + $request_data = []; + $request_data['orderId'] = $orderId;//主订单id 1234345 + $request_data['orderEntryIds'] = $orderEntryIds;//子订单id Long[] + //售中等待买家发货:”refundWaitSellerSend"; 售中等待买家收货:"refundWaitBuyerReceive"; + // 售中已收货(未确认完成交易):"refundBuyerReceived" 售后未收货:"aftersaleBuyerNotReceived"; + // 售后已收到货:"aftersaleBuyerReceived" + $request_data['goodsStatus'] = $goodsStatus;//货物状态 + $res = $this->authObj->request($urlPath, $request_data); + return $res; + } + + /** + * @deprecated 【可在前端通过表单提交】 + * + * 上传退款退货凭证 + * + * https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.trade:alibaba.trade.uploadRefundVoucher-1 + */ + function uploadRefundVoucher($imageData){ + //$urlPath = "param2/1/com.alibaba.trade/alibaba.trade.uploadRefundVoucher/".$this->authObj->config['appkey']; + //$request_data = []; + //$request_data['imageData'] = $imageData;//凭证图片数据。小于1M,jpg格式。 + //$res = $this->authObj->request($urlPath, $request_data); + //return $res; + } + + /** + * 查询退款单列表(买家视角) + * https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.trade:alibaba.trade.refund.buyer.queryOrderRefundList-1&aopApiCategory=trade_new + * 买家查看退款单列表,该接口不支持子账号查询,请使用主账号授权后查询 + */ + function queryOrderRefundList($params){ + $urlPath = "param2/1/com.alibaba.trade/alibaba.trade.refund.buyer.queryOrderRefundList/".$this->authObj->config['appkey']; + $request_data = []; + //订单Id + if(isset($params['orderId'])){ + $request_data['orderId'] = $params['orderId']; + } + //退款申请时间(起始) 20220926114526000+0800 + if(isset($params['applyStartTime'])){ + $request_data['applyStartTime'] = $params['applyStartTime']; + } + //退款申请时间(截止) 20220926114526000+0800 + if(isset($params['applyEndTime'])){ + $request_data['applyEndTime'] = $params['applyEndTime']; + } + //退款状态列表 等待卖家同意 waitselleragree;退款成功 refundsuccess;退款关闭 refundclose; + //待买家修改 waitbuyermodify;等待买家退货 waitbuyersend;等待卖家确认收货 waitsellerreceive + if(isset($params['refundStatusSet'])){ + $request_data['refundStatusSet'] = $params['refundStatusSet']; + } + //卖家memberId + if(isset($params['sellerMemberId'])){ + $request_data['sellerMemberId'] = $params['sellerMemberId']; + } + //当前页码 + if(isset($params['currentPageNum'])){ + $request_data['currentPageNum'] = $params['currentPageNum']; + } + //每页条数 + if(isset($params['pageSize'])){ + $request_data['pageSize'] = $params['pageSize']; + } + //退货物流单号(传此字段查询时,需同时传入sellerMemberId) + if(isset($params['logisticsNo'])){ + $request_data['logisticsNo'] = $params['logisticsNo']; + if(empty($params['sellerMemberId'])){ + return Tools::set_fail('logisticsNo必须与sellerMemberId同时传入'); + } + } + //退款修改时间(起始) 20220926114526000+0800 + if(isset($params['modifyStartTime'])){ + $request_data['modifyStartTime'] = $params['modifyStartTime']; + } + //退款修改时间(截止) 20220926114526000+0800 + if(isset($params['modifyEndTime'])){ + $request_data['modifyEndTime'] = $params['modifyEndTime']; + } + //1:售中退款,2:售后退款;0:所有退款单 + if(isset($params['dipsuteType'])){ + $request_data['dipsuteType'] = $params['dipsuteType']; + } + + + $res = $this->authObj->request($urlPath, $request_data); + return $res; + } + + /** + * 查询退款单详情-根据订单ID(买家视角) + * https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.trade:alibaba.trade.refund.OpQueryBatchRefundByOrderIdAndStatus-1&aopApiCategory=trade_new + */ + function queryBatchRefundByOrderIdAndStatus(int $orderId,string $queryType){ + $urlPath = "param2/1/com.alibaba.trade/alibaba.trade.refund.OpQueryBatchRefundByOrderIdAndStatus/".$this->authObj->config['appkey']; + $request_data = []; + //订单Id + $request_data['orderId'] = $orderId; + //查询类型 1:活动;3:退款成功(只支持退款中和退款成功) + $request_data['queryType'] = $queryType; + $res = $this->authObj->request($urlPath, $request_data); + return $res; + } + + /** + * 退款单操作记录列表(买家视角) + * https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.trade:alibaba.trade.refund.OpQueryOrderRefundOperationList-1 + */ + function queryOrderRefundOperationList(string $refundId,$pageNo=1,$pageSize=100){ + $urlPath = "param2/1/com.alibaba.trade/alibaba.trade.refund.OpQueryOrderRefundOperationList/".$this->authObj->config['appkey']; + $request_data = []; + $request_data['refundId'] = $refundId; + $request_data['pageNo'] = $pageNo; + $request_data['pageSize'] = $pageSize; + $res = $this->authObj->request($urlPath, $request_data); + return $res; + } + /** + * 买家提交退款货信息 + * https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.trade:alibaba.trade.refund.returnGoods-1 + */ + function buyerSubmitRefundGoodsInfo(string $refundId,string $logisticsCompanyNo,string $freightBill,string $description='',string $vouchers=''){ + $urlPath = "param2/1/com.alibaba.trade/alibaba.trade.refund.returnGoods/".$this->authObj->config['appkey']; + $request_data = []; + $request_data['refundId'] = $refundId; + $request_data['logisticsCompanyNo'] = $logisticsCompanyNo; + $request_data['freightBill'] = $freightBill; + if($description){ + $request_data['description'] = $description;//发货说明,内容在2-200个字之间 + } + //凭证图片URLs,必须使用API alibaba.trade.uploadRefundVoucher返回的“图片域名/相对路径”, + //最多可上传 10 张图片 ;单张大小不超过1M;支持jpg、gif、jpeg、png、和bmp格式。 + // 请上传凭证,以便以后续赔所需(不上传将无法理赔) + if($vouchers){ + $request_data['vouchers'] = $vouchers;//[https://cbu01.alicdn.com/img/ibank/2019/901/930/11848039109.jpg] + } + $res = $this->authObj->request($urlPath, $request_data); + return $res; + } +} \ No newline at end of file diff --git a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/tool/Ip.php b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/tool/Ip.php index 57e1490..efe8274 100644 --- a/digital_doctor/vendor/wanghua/general-utility-tools-php/src/tool/Ip.php +++ b/digital_doctor/vendor/wanghua/general-utility-tools-php/src/tool/Ip.php @@ -80,7 +80,6 @@ class Ip * @return bool */ function qihuBaidu($ip){ - $url = 'https://qifu.baidu.com/ip/geo/v1/district?ip='.$ip; if($this->isPrivateIP($ip)){ return true;//国内 } @@ -92,21 +91,24 @@ class Ip if($this->getRecord($ip)){ return false; } - $res = Curl::curl_get($url); + + + + $res = $this->curl_get($ip); if($res['code'] == 200){//请求成功 if(empty($res['data'])){ - Tools::log_to_write_txt(['error'=>'IP查询,curl结果为空','$res'=>$res,'$url'=>$url]); + Tools::log_to_write_txt(['error'=>'IP查询,curl结果为空','$res'=>$res]); } //校验ip属地 $data = json_decode($res['data'],true); if($data['code'] != 'Success'){//查询失败 - Tools::log_to_write_txt(['error'=>'IP查询成功,但结果返回为失败.','$res'=>$res,'$url'=>$url]); + Tools::log_to_write_txt(['error'=>'IP查询成功,但结果返回为失败.','$res'=>$res]); return true; } //查询成功 if(empty($data['data']['country'])){ //country为空时默认为国内 - Tools::log_to_write_txt(['error'=>'IP查询成功,但country返回为空.','$res'=>$res,'$url'=>$url]); + Tools::log_to_write_txt(['error'=>'IP查询成功,但country返回为空.','$res'=>$res]); return true; } if($data['data']['country'] == '中国'){ @@ -117,11 +119,11 @@ class Ip $this->insertRecord($ip,$data['data']['continent'].' '.$data['data']['prov'],$data['data']['country'],'no'); //缓存ip地址 cache($ip,'no');//国外 - Tools::log_to_write_txt(['ip地址不在中国内,禁止访问:'.$ip,'curl data'=>$res['data'],'$url'=>$url]); + Tools::log_to_write_txt(['ip地址不在中国内,禁止访问:'.$ip,'curl data'=>$res['data']]); //return redirect($this->redirect_url); return false; } - Tools::log_to_write_txt(['error'=>'IP查询,curl请求失败.','$res'=>$res,'$url'=>$url]); + Tools::log_to_write_txt(['error'=>'IP查询,curl请求失败.','$res'=>$res]); return true; } /** @@ -188,17 +190,17 @@ class Ip /** CREATE TABLE `fa_ip_attack_record` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', - `ip` varchar(30) NOT NULL DEFAULT '' COMMENT 'IP', - `territory` varchar(50) DEFAULT '' COMMENT '归属地', - `country` varchar(15) DEFAULT '' COMMENT '国家', - `is_china` varchar(10) NOT NULL DEFAULT '' COMMENT '是否中国', - `url` text NOT NULL COMMENT '带域名查询参数', - `params` text COMMENT '参数', - `header` text COMMENT '请求头', - `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '攻击时间', - PRIMARY KEY (`id`) USING BTREE, - KEY `index_ip` (`ip`) USING BTREE + `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', + `ip` varchar(30) NOT NULL DEFAULT '' COMMENT 'IP', + `territory` varchar(50) DEFAULT '' COMMENT '归属地', + `country` varchar(15) DEFAULT '' COMMENT '国家', + `is_china` varchar(10) NOT NULL DEFAULT '' COMMENT '是否中国', + `url` text NOT NULL COMMENT '带域名查询参数', + `params` text COMMENT '参数', + `header` text COMMENT '请求头', + `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '攻击时间', + PRIMARY KEY (`id`) USING BTREE, + KEY `index_ip` (`ip`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='IP攻击记录'; */ @@ -226,4 +228,47 @@ class Ip ->field('id,is_china') ->find(); } + + /** + * desc:curl + * author:wh + * @param $ip + * @return array + */ + function curl_get($ip){ + $curl = curl_init(); + + curl_setopt_array($curl, array( + CURLOPT_URL => 'https://qifu.baidu.com/ip/geo/v1/district?ip='.$ip, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => '', + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 0, + CURLOPT_FOLLOWLOCATION => true, + CURLOPT_HTTP_VERSION => 'CURL_HTTP_VERSION_1_1', + CURLOPT_CUSTOMREQUEST => 'GET', + CURLOPT_HTTPHEADER => array( + 'User-Agent: Apifox/1.0.0 (https://apifox.com)', + 'Accept: */*', + 'Host: qifu.baidu.com', + 'Connection: keep-alive' + ), + )); + + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); + $data = curl_exec($curl); + + // 显示错误信息 + if (curl_error($curl)) { + //print "Error: ".curl_errno($curl).'-' . curl_error($curl); + //返回错误码 + return ['code' => curl_errno($curl), 'msg' => curl_error($curl)]; + } else { + //关闭句柄 + curl_close($curl); + // 返回的内容 + return ['code' => 200, 'msg' => 'cURL ok', 'data' => $data]; + } + } } \ No newline at end of file