TestController.php 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\ghs\classes\GhsClass;
  4. use biz\shop\classes\ShopClass;
  5. use biz\sj\services\MerchantService;
  6. use biz\wx\classes\WxMessageClass;
  7. use bizGhs\custom\classes\CustomClass;
  8. use bizGhs\custom\classes\CustomDebtChangeClass;
  9. use bizGhs\express\services\DadaExpressServices;
  10. use bizGhs\order\classes\OrderClass;
  11. use bizGhs\order\classes\RefundOrderClass;
  12. use bizHd\message\classes\InformAdminClass;
  13. use bizHd\order\services\OrderService;
  14. use bizHd\purchase\classes\PurchaseClass;
  15. use bizHd\purchase\classes\PurchaseClearClass;
  16. use bizHd\wx\classes\WxOpenClass;
  17. use bizGhs\express\services\MiniExpressService;
  18. use common\components\arrayUtil;
  19. use common\components\dict;
  20. use common\components\lakala\Lakala;
  21. use common\components\miniUtil;
  22. use common\components\noticeUtil;
  23. use common\components\orderSn;
  24. use common\components\wxUtil;
  25. use common\components\payUtil;
  26. use Yii;
  27. use common\components\util;
  28. use wkhtmltox\Image\Converter;
  29. class TestController extends BaseController
  30. {
  31. public $guestAccess = ['in', 'clear-query', 'ip', 'html', 'debt', 'apply', 'clear', 'ls-trade-query', 'refund-query', 'inform', 'notice', 'order-query', 'add-order', 'index', 'get', 'trade-query', 'query', 'balance-query', 'refund'];
  32. public function actionIn()
  33. {
  34. }
  35. public function actionIp()
  36. {
  37. $ip = $_SERVER['SERVER_ADDR'] ?? '';
  38. echo $ip;
  39. }
  40. public function actionHtml()
  41. {
  42. $c = new Converter(null, [
  43. "fmt" => "png",
  44. "in" => "/tmp/a.html",
  45. "out" => "/tmp/test.png"
  46. ]);
  47. $c->convert();
  48. }
  49. //欠款的查询与跟踪 ssh 20240103
  50. public function actionDebt()
  51. {
  52. $customId = 17081;
  53. $custom = CustomClass::getById($customId, true);
  54. if (empty($custom)) {
  55. echo '没有找到客户';
  56. die;
  57. }
  58. $flag = [];
  59. $changeList = CustomDebtChangeClass::getAllByCondition(['customId' => $customId], null, '*');
  60. if (!empty($changeList)) {
  61. foreach ($changeList as $change) {
  62. $event = $change['evnet'] ?? '';
  63. $relateId = $change['relateId'] ?? 0;
  64. $amount = $change['amount'] ?? 0;
  65. if (strpos($event, '购买花材') >= 0) {
  66. $flag['40-' . $relateId] = $amount;
  67. }
  68. if (strpos($event, '退款') >= 0) {
  69. $flag['33-' . $relateId] = $amount;
  70. }
  71. if (strpos($event, '结账') >= 0) {
  72. $flag['20-' . $relateId] = $amount;
  73. }
  74. }
  75. }
  76. print_r($flag);
  77. $orderList = OrderClass::getAllByCondition(['customId' => $customId, 'debtPrice>' => 0], null, 'id,actPrice,payTime', null);
  78. $arr = [];
  79. if (!empty($orderList)) {
  80. foreach ($orderList as $order) {
  81. $payTime = $order['payTime'] ?? '';
  82. $id = $order['id'] ?? 0;
  83. $arr[$payTime] = $order;
  84. if (isset($flag['40-' . $id]) == false) {
  85. echo '40-' . $id . "订单有问题\n";
  86. }
  87. }
  88. }
  89. //20
  90. $clearList = PurchaseClearClass::getAllByCondition(['customId' => $customId, 'status' => 2], null, 'id,actPrice,payTime', null);
  91. if (!empty($clearList)) {
  92. foreach ($clearList as $clear) {
  93. $payTime = $clear['payTime'] ?? '';
  94. $id = $clear['id'] ?? 0;
  95. $arr[$payTime] = $clear;
  96. if (isset($flag['20-' . $id]) == false) {
  97. echo '20-' . $id . "结账有问题\n";
  98. }
  99. }
  100. }
  101. //33
  102. $refundList = RefundOrderClass::getAllByCondition(['customId' => $customId], null, 'id,refundPrice,updateTime', null);
  103. if (!empty($refundList)) {
  104. foreach ($refundList as $refund) {
  105. $id = $refund['id'] ?? 0;
  106. $updateTime = $refund['updateTime'] ?? '';
  107. $arr[$updateTime] = $refund;
  108. if (isset($flag['33-' . $id]) == false) {
  109. echo '33-' . $id . "退款单有问题\n";
  110. }
  111. }
  112. }
  113. echo "<pre>";
  114. ksort($arr);
  115. print_r($arr);
  116. die;
  117. }
  118. //退款操作 ssh 20231029
  119. public function actionRefund()
  120. {
  121. $shopId = 36524;
  122. $shop = ShopClass::getById($shopId, true);
  123. if (empty($shop)) {
  124. util::fail('没有找到门店');
  125. }
  126. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  127. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  128. $params = [
  129. 'appid' => 'OP00002119',
  130. 'serial_no' => '018b08cfddbd',
  131. 'merchant_no' => $shop->lklSjNo,
  132. 'term_no' => $shop->lklB2BTermNo,
  133. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  134. 'lklCertificatePath' => $lklCertificatePath,
  135. ];
  136. $laResource = new Lakala($params);
  137. $refundReason = '暂无';
  138. $refundOrderSn = orderSn::getCgRefundSn();
  139. $refundPrice = 0.01;
  140. $refundFee = bcmul($refundPrice, 100);
  141. $orderSn = 'KD_CS61235203';
  142. $originTradeNo = '20231030110113230266215266468756';
  143. //$originLogNo = '66215266025626';
  144. $aliParams = [
  145. 'refundSn' => $refundOrderSn,
  146. 'orderSn' => $orderSn,
  147. 'refundAmount' => $refundFee,
  148. 'refundReason' => $refundReason,
  149. 'originTradeNo' => $originTradeNo,
  150. //'originLogNo' => $originLogNo,
  151. ];
  152. $response = $laResource->refund($aliParams);
  153. echo '<pre>';
  154. print_r($response);
  155. }
  156. public function actionApply()
  157. {
  158. $id = 2888;
  159. $shopId = 36524;
  160. $cg = PurchaseClass::getById($id, true);
  161. $shop = ShopClass::getById($shopId, true);
  162. WxMessageClass::hdNewCgOrderInform($shop, $cg);
  163. }
  164. public function actionGet()
  165. {
  166. ini_set('memory_limit', '2045M');
  167. set_time_limit(0);
  168. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  169. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  170. $arr = [
  171. //['name' => '国兰花尚OK', 'merchantNo' => '82239305992006L', 'wx' => [600913569, 600907053], 'zfb' => '2088820709029782'],
  172. //['name' => '花掌柜OK', 'merchantNo' => '82240505992000P', 'wx' => [600466131, 600465187], 'zfb' => '2088820656569304'],
  173. //['name' => '纯彩花艺OK', 'merchantNo' => '82239305992006M', 'wx' => [600922790, 600915407], 'zfb' => '2088820710146836'],
  174. //['name' => '集美天天鲜花OK', 'merchantNo' => '82239305992006P', 'wx' => [601036538, 601036322], 'zfb' => '2088820726763339'],
  175. //['name' => '丰行花行OK', 'merchantNo' => '82260205992007P', 'wx' => [601053759, 601052157], 'zfb' => '2088820725885465'],
  176. //['name' => '独家花行OK', 'merchantNo' => '82239305992006Q', 'wx' => [601049483, 601048223], 'zfb' => '2088820725546555'],
  177. //['name' => '好多花海沧OK', 'merchantNo' => '82239305992006R', 'wx' => [601052177, 601053735], 'zfb' => '2088820725549695'],
  178. //['name' => '美天鲜花OK', 'merchantNo' => '82259505992003F', 'wx' => [601062064, 601138175], 'zfb' => '2088820729400990'],
  179. //['name' => '天天陈江店OK', 'merchantNo' => '82259505992003E', 'wx' => [601060616, 601059382], 'zfb' => '2088820725555368'],
  180. //['name' => '叶上花OK', 'merchantNo' => '82231805992002G', 'wx' => [601062892, 601062589], 'zfb' => '2088820728763546'],
  181. //['name' => '好又多(小明)OK', 'merchantNo' => '82239305992006S', 'wx' => [601135715, 601067347], 'zfb' => '2088820729698012'],
  182. //['name' => '我卖花OK', 'merchantNo' => '82227505992000R', 'wx' => [601177139, 601148755], 'zfb' => '2088820746424032'],
  183. //['name' => '问境OK', 'merchantNo' => '8226900599200KX', 'wx' => [601299388, 601299453], 'zfb' => '2088820787661843'],
  184. //['name' => '昱成OK', 'merchantNo' => '8226900599200KY', 'wx' => [601312993, 601325844], 'zfb' => '2088820788900240'],
  185. //['name' => '杭州斗南', 'merchantNo' => '杭州斗南', 'wx' => [601405963, 601405929], 'zfb' => '2088820793601705'],
  186. //['name' => '杭州斗南(没用)', 'merchantNo' => '8223310599200AD', 'wx' => [601254682, 601250805], 'zfb' => '2088820782666872'],
  187. //['name' => '珑松花卉长安店', 'merchantNo' => '82260205992007U', 'wx' => [602499045, 602497558], 'zfb' => '2088820959620797'],
  188. //['name' => '福州花福(个人)', 'merchantNo' => '82239105992007P', 'wx' => [603301197, 603302321], 'zfb' => '2088920058098261'],
  189. //['name' => '福州花福', 'merchantNo' => '82239105992007N', 'wx' => [602796807, 602774796], 'zfb' => '2088820996010582'],
  190. //['name' => '昆明新宏源', 'merchantNo' => '82239305992007H', 'wx' => [606098318, 606100317], 'zfb' => '2088920878302843'],
  191. //['name' => '昆明纯彩', 'merchantNo' => '82239905992003L', 'wx' => [604923629, 604922175], 'zfb' => '2088920533160795'],
  192. //['name' => '花优田(军兴旺)', 'merchantNo' => '8227310599200GX', 'wx' => [605191281, 605190492], 'zfb' => '2088920588715249'],
  193. //['name' => '肇庆兄弟鲜花', 'merchantNo' => '82259305992001V', 'wx' => [628299301, 628297384], 'zfb' => '2088930936937722'],
  194. //['name' => '郑州唯一鲜花', 'merchantNo' => '8224910599200NB', 'wx' => [624877731, 624877902], 'zfb' => '2088830970964611'],
  195. //['name' => '昆明期待鲜花', 'merchantNo' => '8227310599200J6', 'wx' => [615582300, 615582180], 'zfb' => '2088530113958388'],
  196. //['name' => '厦门遇见你', 'merchantNo' => '82239305992008D', 'wx' => [614782373, 614783346], 'zfb' => '2088430828233036'],
  197. //['name' => '淄博花超鲜花批发', 'merchantNo' => '82245305992001R', 'wx' => [614685779, 614682986], 'zfb' => '2088430805221810'],
  198. //['name' => '广州国恋', 'merchantNo' => '8225810599200Q7', 'wx' => [612321716, 612320978], 'zfb' => '2088330479975012'],
  199. //['name' => '欣研鲜花', 'merchantNo' => '82260305992001Y', 'wx' => [612181234, 612181615], 'zfb' => '2088330365608286'],
  200. //['name' => '村长冷链', 'merchantNo' => '82260205992008G', 'wx' => [612168406, 612168000], 'zfb' => '2088330360870932'],
  201. //['name' => '惠州惠雅鲜花批发', 'merchantNo' => '82259505992003S', 'wx' => [611676975, 611677314], 'zfb' => '2088330136601427'],
  202. //['name' => '杭州斗南鲜花', 'merchantNo' => '8223310599200AR', 'wx' => [608955814, 608955082], 'zfb' => '2088130449323603'],
  203. //['name' => '营口简约花卉', 'merchantNo' => '8227310599200HJ', 'wx' => [608439898, 608440994], 'zfb' => '2088130112725929'],
  204. //['name' => '惠雅鲜花惠州店', 'merchantNo' => '82260205992007Z', 'wx' => [608406948, 608403207], 'zfb' => '2088130098167302'],
  205. //['name' => '云南珑松花卉珠海店', 'merchantNo' => '82258505992002U', 'wx' => [608062727, 608056474], 'zfb' => '2088030873238576'],
  206. //['name' => '昆明鹏诚花卉', 'merchantNo' => '8227310599200JK', 'wx' => [630710385, 630711403], 'zfb' => '2088040532857091'],
  207. ['name' => '心悦花艺馆', 'merchantNo' => '82247305992002L', 'wx' => [632850138, 632849309], 'zfb' => '2088140048248384'],
  208. //['name' => '买手很忙', 'merchantNo' => '8227310599200GJ', 'wx' => [601597167, 601595526], 'zfb' => '2088820818930267'],
  209. //['name' => '七彩花都', 'merchantNo' => '8227310599200GF', 'wx' => [601176481, 601148503], 'zfb' => '2088820748594478'],
  210. //['name' => '十年', 'merchantNo' => '82252305992001U', 'wx' => [601285154, 601261795], 'zfb' => '2088820782171763'],
  211. //['name' => '都市花季OK', 'merchantNo' => '82239305992006U', 'wx' => [601174342, 601147649], 'zfb' => '2088820748507346'],
  212. //['name' => '花样年华OK', 'merchantNo' => '82260205992007Q', 'wx' => [601134352, 601091710], 'zfb' => '2088820735043444'],
  213. //['name' => '精茂城OK', 'merchantNo' => '8225840599200TF', 'wx' => [601173752, 601143352], 'zfb' => '2088820746800005'],
  214. //['name' => '莱漫OK', 'merchantNo' => '82239305992007A', 'wx' => [601288494, 601288166], 'zfb' => '2088820783686611'],
  215. //['name' => '莱漫(没用)', 'merchantNo' => '82239305992006T', 'wx' => [601134065, 601125595], 'zfb' => '2088820743859918'],
  216. //['name' => '福州我要花OK', 'merchantNo' => '82239105992007J', 'wx' => [601134030, 601128111], 'zfb' => '2088820745276973'],
  217. //['name' => '泉城OK', 'merchantNo' => '82239705992004F', 'wx' => [601273270, 601272854], 'zfb' => '2088820784658561'],
  218. //['name' => '泉城(没用)', 'merchantNo' => '82239705992004E', 'wx' => [601133056, 601133821], 'zfb' => '2088820746111323'],
  219. //['name' => '美丽花行OK', 'merchantNo' => '82239305992006V', 'wx' => [601155249, 601149712], 'zfb' => '2088820747673312'],
  220. //['name' => '三叶OK', 'merchantNo' => '82236805992001Y', 'wx' => [601152233, 601151024], 'zfb' => '2088820747556725'],
  221. //['name' => '花大苪OK', 'merchantNo' => '8227310599200GG', 'wx' => [601174221, 601165136], 'zfb' => '2088820751181377'],
  222. //['name' => '十堰天天鲜花OK', 'merchantNo' => '82252305992001S', 'wx' => [601171131, 601170642], 'zfb' => '2088820750844626'],
  223. //['name' => '珑松花卉OK', 'merchantNo' => '82260205992007S', 'wx' => [601176093, 601174262], 'zfb' => '2088820754742492'],
  224. //['name' => '惠雅鲜花OK', 'merchantNo' => '82260205992007R', 'wx' => [601173390, 601174002], 'zfb' => '2088820753174540'],
  225. //['name' => '锦绣花卉OK', 'merchantNo' => '82252305992001T', 'wx' => [601176719, 601176660], 'zfb' => '2088820754751663'],
  226. //['name' => '祥瑞鲜花同安店OK', 'merchantNo' => '82239305992006W', 'wx' => [601178350, 601177795], 'zfb' => '2088820755715024'],
  227. //['name' => '祥瑞鲜花翔安店OK', 'merchantNo' => '82239305992006X', 'wx' => [601178260, 601178199], 'zfb' => '2088820754481553'],
  228. //['name' => '初见花季OK', 'merchantNo' => '82239305992006Y', 'wx' => [601178998, 601179605], 'zfb' => '2088820757223312'],
  229. //['name' => '荣发鲜花OK', 'merchantNo' => '82242705992000D', 'wx' => [601179681, 601179180], 'zfb' => '2088820756926593'],
  230. //['name' => '花千朵(多多)OK', 'merchantNo' => '82239305992006Z', 'wx' => [601223474, 601208096], 'zfb' => '2088820766783276'],
  231. //['name' => '花悠星OK', 'merchantNo' => '8225810599200NH', 'wx' => [601228194, 601227691], 'zfb' => '2088820774587446'],
  232. //['name' => '花悠星(没用)', 'merchantNo' => '8225810599200NG', 'wx' => [601223630, 601210952], 'zfb' => '2088820767072874'],
  233. //['name' => '源花汇OK', 'merchantNo' => '82222105992004A', 'wx' => [601221944, 601214269], 'zfb' => '2088820770594246'],
  234. //['name' => '源花汇2(没用)', 'merchantNo' => '8227310599200GD', 'wx' => [601136305, 601067016], 'zfb' => '2088820729832744'],
  235. ];
  236. $new = [];
  237. foreach ($arr as $item) {
  238. $wx = $item['wx'];
  239. $zfb = $item['zfb'];
  240. $merchantNo = $item['merchantNo'];
  241. $name = $item['name'] . ' ' . $merchantNo;
  242. $group = [];
  243. foreach ($wx as $oneWx) {
  244. $params = [
  245. 'appid' => 'OP00002119',
  246. 'serial_no' => '018b08cfddbd',
  247. 'merchant_no' => $merchantNo,
  248. 'term_no' => 'C6337694',
  249. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  250. 'lklCertificatePath' => $lklCertificatePath,
  251. ];
  252. $data = [
  253. 'subMerchantId' => $oneWx,
  254. 'tradeMode' => 'WECHAT',
  255. ];
  256. $laResource = new Lakala($params);
  257. $response = $laResource->openStateQuery($data);
  258. $statusName = '出错了';
  259. if ($response['retCode'] == '000000') {
  260. $checkResult = $response['respData']['checkResult'] ?? '';
  261. $statusName = '未认证';
  262. if ($checkResult == 'AUTHORIZE_STATE_AUTHORIZED') {
  263. $statusName = '已认证';
  264. }
  265. }
  266. $group[] = '微信 ' . $oneWx . ' ' . $statusName;
  267. }
  268. $params = [
  269. 'appid' => 'OP00002119',
  270. 'serial_no' => '018b08cfddbd',
  271. 'merchant_no' => $merchantNo,
  272. 'term_no' => 'C6337694',
  273. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  274. 'lklCertificatePath' => $lklCertificatePath,
  275. ];
  276. $data = [
  277. 'subMerchantId' => $zfb,
  278. 'tradeMode' => 'ALIPAY',
  279. ];
  280. $laResource = new Lakala($params);
  281. $response = $laResource->openStateQuery($data);
  282. $statusName = '出错了';
  283. if ($response['retCode'] == '000000') {
  284. $checkResult = $response['respData']['checkResult'] ?? '';
  285. $statusName = '未认证';
  286. if ($checkResult == 'AUTHORIZED') {
  287. $statusName = '已认证';
  288. }
  289. }
  290. $group[] = '支付宝 ' . $zfb . ' ' . $statusName;
  291. $new[] = ['name' => $name, 'status' => $group];
  292. }
  293. echo '<pre>';
  294. print_r($new);
  295. die;
  296. }
  297. public function actionRefundQuery()
  298. {
  299. $shopId = 520;
  300. $shop = ShopClass::getById($shopId, true);
  301. if (empty($shop)) {
  302. util::stop('没有找到门店');
  303. }
  304. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  305. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  306. $params = [
  307. 'appid' => 'OP00002119',
  308. 'serial_no' => '018b08cfddbd',
  309. 'merchant_no' => $shop->lklSjNo,
  310. 'term_no' => $shop->lklScanTermNo,
  311. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  312. 'lklCertificatePath' => $lklCertificatePath,
  313. ];
  314. $laResource = new Lakala($params);
  315. $orderSn = '20231201110113131266165492618754';
  316. $data = [
  317. 'orderSn' => $orderSn,
  318. ];
  319. $response = $laResource->refundQuery($data);
  320. echo "<pre>";
  321. print_r($response);
  322. }
  323. public function actionBalanceQuery()
  324. {
  325. $shopId = 1212;
  326. $shop = ShopClass::getById($shopId, true);
  327. if (empty($shop)) {
  328. util::stop('没有找到门店');
  329. }
  330. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  331. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  332. $params = [
  333. 'appid' => 'OP00002119',
  334. 'serial_no' => '018b08cfddbd',
  335. 'merchant_no' => $shop->lklSjNo,
  336. 'term_no' => $shop->lklScanTermNo,
  337. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  338. 'lklCertificatePath' => $lklCertificatePath,
  339. ];
  340. $laResource = new Lakala($params);
  341. $response = $laResource->accountBalanceQuery();
  342. echo "<pre>";
  343. print_r($response);
  344. }
  345. //测试环境查线上数据 ssh 20231230
  346. public function actionCsQuery()
  347. {
  348. // $shopId = 1527;
  349. // $shop = ShopClass::getById($shopId, true);
  350. // if (empty($shop)) {
  351. // util::stop('没有找到门店');
  352. // }
  353. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  354. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  355. $params = [
  356. 'appid' => 'OP00002119',
  357. 'serial_no' => '018b08cfddbd',
  358. //'merchant_no' => $shop->lklSjNo,
  359. 'merchant_no' => '82222105992004A',
  360. //'term_no' => $shop->lklScanTermNo,
  361. 'term_no' => 'H3656802',
  362. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  363. 'lklCertificatePath' => $lklCertificatePath,
  364. ];
  365. $laResource = new Lakala($params);
  366. $queryParams = [
  367. //'orderSn' => 'KD26452235',
  368. 'tradeNo' => '20231230110113130266215700775011',
  369. ];
  370. $response = $laResource->query($queryParams, 1);
  371. echo "<pre>";
  372. print_r($response);
  373. }
  374. public function actionQuery()
  375. {
  376. $shopId = 726;
  377. $shop = ShopClass::getById($shopId, true);
  378. if (empty($shop)) {
  379. util::stop('没有找到门店');
  380. }
  381. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  382. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  383. $params = [
  384. 'appid' => 'OP00002119',
  385. 'serial_no' => '018b08cfddbd',
  386. 'merchant_no' => $shop->lklSjNo,
  387. 'term_no' => $shop->lklScanTermNo,
  388. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  389. 'lklCertificatePath' => $lklCertificatePath,
  390. ];
  391. $laResource = new Lakala($params);
  392. $queryParams = [
  393. 'orderSn' => 'KD26481486',
  394. //'tradeNo' => '20231230110113130266215700775011',
  395. ];
  396. $response = $laResource->query($queryParams, 0);
  397. echo "<pre>";
  398. print_r($response);
  399. }
  400. public function actionClearQuery()
  401. {
  402. $shopId = 8249;
  403. $shop = ShopClass::getById($shopId, true);
  404. if (empty($shop)) {
  405. util::stop('没有找到门店');
  406. }
  407. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  408. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  409. $params = [
  410. 'appid' => 'OP00002119',
  411. 'serial_no' => '018b08cfddbd',
  412. 'merchant_no' => $shop->lklSjNo,
  413. 'term_no' => $shop->lklScanTermNo,
  414. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  415. 'lklCertificatePath' => $lklCertificatePath,
  416. ];
  417. $laResource = new Lakala($params);
  418. $queryParams = [
  419. //'orderSn' => 'CL28693295',
  420. 'tradeNo' => '66215417437878',
  421. ];
  422. $response = $laResource->query($queryParams, 1);
  423. echo "<pre>";
  424. print_r($response);
  425. }
  426. //零售订单查询 ssh 20231031
  427. public function actionLsTradeQuery()
  428. {
  429. $shopId = 764;
  430. $shop = ShopClass::getById($shopId, true);
  431. if (empty($shop)) {
  432. util::stop('没有找到门店');
  433. }
  434. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  435. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  436. $params = [
  437. 'appid' => 'OP00002119',
  438. 'serial_no' => '018b08cfddbd',
  439. 'merchant_no' => $shop->lklSjNo,
  440. 'term_no' => $shop->lklScanTermNo,
  441. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  442. 'lklCertificatePath' => $lklCertificatePath,
  443. ];
  444. $laResource = new Lakala($params);
  445. $queryParams = [
  446. 'orderSn' => 'KD26499746',
  447. //'tradeNo' => '20231029110113130266215259252887',
  448. ];
  449. $response = $laResource->query($queryParams, 0);
  450. print_r($response);
  451. util::stop();
  452. if (isset($response['code']) && $response['code'] == 'BBS00000') {
  453. $connection = Yii::$app->db;
  454. $transaction = $connection->beginTransaction();
  455. try {
  456. $postData = $response['resp_data'] ?? [];
  457. $orderSn = $postData['out_trade_no'] ?? '';
  458. $total_amount = $postData['total_amount'] ?? 0;
  459. $account_type = $postData['account_type'] ?? '';
  460. if (empty($account_type)) {
  461. noticeUtil::push('支付回调失败了,没有找到钱包类型,请注意,orderSn:' . $orderSn, '15280215347');
  462. util::end();
  463. }
  464. $totalFee = $total_amount / 100;
  465. $transactionId = $postData['trade_no'] ?? 0;
  466. $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
  467. $currentPayWay = null;
  468. if ($account_type == 'WECHAT') {
  469. $currentPayWay = dict::getDict('payWay', 'wxPay');
  470. } elseif ($account_type == 'ALIPAY') {
  471. $currentPayWay = dict::getDict('payWay', 'alipay');
  472. } else {
  473. noticeUtil::push('支付回调失败了,没有找到支付类型,orderSn:' . $orderSn, '15280215347');
  474. util::end();
  475. }
  476. $attach = '';
  477. payUtil::thirdPay($currentPayWay, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
  478. $transaction->commit();
  479. echo 'OK';
  480. } catch (\Exception $e) {
  481. $transaction->rollBack();
  482. Yii::error("失败原因:" . $e->getMessage());
  483. }
  484. }
  485. }
  486. //零售订单查询 ssh 20231031
  487. public function actionClear()
  488. {
  489. $shopId = 10649;
  490. $shop = ShopClass::getById($shopId, true);
  491. if (empty($shop)) {
  492. util::stop('没有找到门店');
  493. }
  494. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  495. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  496. $params = [
  497. 'appid' => 'OP00002119',
  498. 'serial_no' => '018b08cfddbd',
  499. 'merchant_no' => $shop->lklSjNo,
  500. 'term_no' => $shop->lklScanTermNo,
  501. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  502. 'lklCertificatePath' => $lklCertificatePath,
  503. ];
  504. $laResource = new Lakala($params);
  505. $queryParams = [
  506. //'orderSn' => 'KD26461864',
  507. 'tradeNo' => '20231230110113130266215700775011',
  508. ];
  509. $response = $laResource->query($queryParams, 1);
  510. print_r($response);
  511. util::stop();
  512. if (isset($response['code']) && $response['code'] == 'BBS00000') {
  513. $connection = Yii::$app->db;
  514. $transaction = $connection->beginTransaction();
  515. try {
  516. $postData = $response['resp_data'] ?? [];
  517. $orderSn = $postData['out_trade_no'] ?? '';
  518. $total_amount = $postData['total_amount'] ?? 0;
  519. $account_type = $postData['account_type'] ?? '';
  520. if (empty($account_type)) {
  521. noticeUtil::push('支付回调失败了,没有找到钱包类型,请注意,orderSn:' . $orderSn, '15280215347');
  522. util::end();
  523. }
  524. $totalFee = $total_amount / 100;
  525. $transactionId = $postData['trade_no'] ?? 0;
  526. $capitalType = dict::getDict('capitalType', 'hdPurchaseClear', 'id');
  527. $currentPayWay = null;
  528. if ($account_type == 'WECHAT') {
  529. $currentPayWay = dict::getDict('payWay', 'wxPay');
  530. } elseif ($account_type == 'ALIPAY') {
  531. $currentPayWay = dict::getDict('payWay', 'alipay');
  532. } else {
  533. noticeUtil::push('支付回调失败了,没有找到支付类型,orderSn:' . $orderSn, '15280215347');
  534. util::end();
  535. }
  536. $attach = '';
  537. payUtil::thirdPay($currentPayWay, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
  538. $transaction->commit();
  539. echo 'OK';
  540. } catch (\Exception $e) {
  541. $transaction->rollBack();
  542. Yii::error("失败原因:" . $e->getMessage());
  543. }
  544. }
  545. }
  546. //交易查询 ssh 20231021
  547. public function actionTradeQuery()
  548. {
  549. $shopId = 10649;
  550. $shop = ShopClass::getById($shopId, true);
  551. if (empty($shop)) {
  552. util::stop('没有找到门店');
  553. }
  554. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  555. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  556. $params = [
  557. 'appid' => 'OP00002119',
  558. 'serial_no' => '018b08cfddbd',
  559. 'merchant_no' => $shop->lklSjNo,
  560. 'term_no' => $shop->lklScanTermNo,
  561. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  562. 'lklCertificatePath' => $lklCertificatePath,
  563. ];
  564. $laResource = new Lakala($params);
  565. $queryParams = [
  566. 'orderSn' => 'CG26977164',
  567. //'tradeNo' => '66215960152739',
  568. ];
  569. $response = $laResource->query($queryParams, 1);
  570. print_r($response);
  571. util::stop();
  572. if (isset($response['code']) && $response['code'] == 'BBS00000') {
  573. $capitalType = dict::getDict('capitalType', 'xhPurchase', 'id');
  574. $connection = Yii::$app->db;
  575. $transaction = $connection->beginTransaction();
  576. try {
  577. $account_type = $response['resp_data']['account_type'] ?? 0;
  578. if (empty($account_type)) {
  579. noticeUtil::push('支付回调失败了,没有找到钱包类型,请注意', '15280215347');
  580. util::end();
  581. }
  582. $currentPayWay = null;
  583. if ($account_type == 'WECHAT') {
  584. $currentPayWay = dict::getDict('payWay', 'wxPay');
  585. } elseif ($account_type == 'ALIPAY') {
  586. $currentPayWay = dict::getDict('payWay', 'alipay');
  587. } else {
  588. noticeUtil::push('支付回调失败了,没有找到支付类型', '15280215347');
  589. util::end();
  590. }
  591. $attach = '';
  592. $total_amount = $response['resp_data']['total_amount'] ?? 0;
  593. $orderSn = $response['resp_data']['out_trade_no'] ?? 0;
  594. $totalFee = $total_amount / 100;
  595. $transactionId = $response['resp_data']['trade_no'] ?? 0;
  596. payUtil::thirdPay($currentPayWay, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
  597. $transaction->commit();
  598. echo 'OK';
  599. } catch (\Exception $e) {
  600. $transaction->rollBack();
  601. Yii::error("失败原因:" . $e->getMessage());
  602. }
  603. }
  604. }
  605. public function actionAliRun2()
  606. {
  607. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  608. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  609. $params = [
  610. 'appid' => 'OP00002119',
  611. 'serial_no' => '018b08cfddbd',
  612. 'merchant_no' => '82240505992000N',
  613. 'term_no' => 'C6337694',
  614. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  615. 'lklCertificatePath' => $lklCertificatePath,
  616. ];
  617. $outTradeNo = orderSn::getPurchaseSn();
  618. $notifyUrl = Yii::$app->params['hdHost'] . "/notice/pay-callback";
  619. $currentCapitalType = dict::getDict('capitalType', 'xhPurchase', 'id');
  620. $aliParams = [
  621. 'orderSn' => $outTradeNo,
  622. 'amount' => 0.16,
  623. 'capitalType' => $currentCapitalType,
  624. 'notifyUrl' => $notifyUrl,
  625. ];
  626. $laResource = new Lakala($params);
  627. $response = $laResource->driveAliPay($aliParams);
  628. if ($response && isset($response['cmdRetCode']) && $response['cmdRetCode'] == 'GLOBAL_SUCCESS') {
  629. echo '<pre>';
  630. echo "下单成功<br/>";
  631. print_r($response);
  632. } else {
  633. echo '<pre>';
  634. echo "下单失败<br/>";
  635. print_r($response);
  636. }
  637. }
  638. public function actionAliRun3()
  639. {
  640. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  641. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  642. $params = [
  643. 'appid' => 'OP00002119',
  644. 'serial_no' => '018b08cfddbd',
  645. 'merchant_no' => '82240505992000N',
  646. 'term_no' => 'C6337694',
  647. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  648. 'lklCertificatePath' => $lklCertificatePath,
  649. ];
  650. $laResource = new Lakala($params);
  651. $outTradeNo = orderSn::getPurchaseSn();
  652. $notifyUrl = Yii::$app->params['hdHost'] . "/notice/pay-callback";
  653. $currentCapitalType = dict::getDict('capitalType', 'xhPurchase', 'id');
  654. $wxParams = [
  655. 'orderSn' => $outTradeNo,
  656. 'amount' => 0.16,
  657. 'capitalType' => $currentCapitalType,
  658. 'notifyUrl' => $notifyUrl,
  659. ];
  660. $response = $laResource->driveWxPay($wxParams);
  661. if ($response && isset($response['cmdRetCode']) && $response['cmdRetCode'] == 'GLOBAL_SUCCESS') {
  662. echo '<pre>';
  663. echo "下单成功<br/>";
  664. print_r($response);
  665. } else {
  666. echo '<pre>';
  667. echo "下单失败<br/>";
  668. print_r($response);
  669. }
  670. }
  671. //dada 城市code
  672. public function actionDadaCityCode()
  673. {
  674. $res = dada::getCityCode(0);
  675. util::success($res);
  676. }
  677. //理由
  678. public function actionDadaReasons()
  679. {
  680. $res = dada::getCancelReason(0);
  681. util::success($res);
  682. }
  683. //达达 :下单
  684. public function actionDadaAddOrder()
  685. {
  686. $orderSn = 'XSD_CS26316851';
  687. $orderInfo = OrderClass::getByOrderSn($orderSn);
  688. $res = DadaExpressServices::addOrder($orderInfo);
  689. util::success($res);
  690. }
  691. //重发快递
  692. public function actionDadaReAdd()
  693. {
  694. $orderSn = 'XSD_CS26316851';
  695. $orderInfo = OrderClass::getByOrderSn($orderSn);
  696. $res = DadaExpressServices::reAddOrder($orderInfo);
  697. util::success($res);
  698. }
  699. //达达状态查询
  700. public function actionDadaOrderStatus()
  701. {
  702. $orderSn = 'XSD_CS26316851';
  703. $res = DadaExpressServices::statusOrder($orderSn);
  704. util::success($res);
  705. }
  706. //达达取消下单
  707. public function actionDadaCancelOrder()
  708. {
  709. $orderSn = 'XSD_CS26316851';
  710. $res = DadaExpressServices::cancelOrder($orderSn, 1);
  711. util::success($res);
  712. }
  713. //获取已支持的配送公司列表接口
  714. public function actionGetAllDelivery()
  715. {
  716. $data = MiniExpressService::getAllImmeDelivery();
  717. util::success($data);
  718. }
  719. //即时配送
  720. /*
  721. * Array
  722. (
  723. [resultcode] => 0
  724. [resultmsg] => OK
  725. [shop_list] => Array
  726. (
  727. [0] => Array
  728. (
  729. [shopid] => 1588714266
  730. [delivery_id] => SFTC
  731. [audit_result] => 0
  732. [create_time] => 1612172838
  733. [remark] =>
  734. [delivery_name] => 顺丰同城急送
  735. )
  736. )
  737. )
  738. */
  739. public function actionGetBindAccount()
  740. {
  741. $merchant = WxOpenClass::getGhsWxInfo();
  742. $isOpen = 2;
  743. $r = miniUtil::getBindAccount($merchant, $isOpen);
  744. dd($r);
  745. }
  746. //下单 (沙箱)
  747. /**
  748. * Array
  749. * (
  750. * [resultcode] => 0
  751. * [resultmsg] => ok
  752. * [fee] => 10
  753. * [waybill_id] => test_shop_id1612365974_waybillid
  754. * [order_status] => 101
  755. * [dispatch_duration] => 300
  756. * )
  757. */
  758. public function actionCreateWaybill()
  759. {
  760. $merchant = WxOpenClass::getGhsWxInfo();
  761. $isOpen = 2;
  762. $shopId = 'test_shop_id';
  763. $shopOrderId = 'test_shop_id' . time();
  764. $appSecret = 'test_app_secrect';
  765. $data = [
  766. 'shopid' => $shopId,
  767. 'shop_order_id' => $shopOrderId,
  768. 'shop_no' => '1',
  769. 'delivery_sign' => miniUtil::getDeliverySign($shopId, $shopOrderId, $appSecret), //,则delivery_sign=SHA1(shopid + shop_order_id + AppSecret)
  770. 'delivery_id' => "TEST",
  771. 'openid' => 'oGKMp45YLxewOTWEbpMFzWoVqdW0',
  772. 'sender' => [
  773. 'name' => 'test',
  774. 'city' => '厦门市',
  775. 'address' => '思明区',
  776. 'address_detail' => '软件园二期',
  777. 'phone' => '19959271111',
  778. 'lng' => 118.134343,
  779. 'lat' => 24.483566,
  780. 'coordinate_type' => 0,
  781. ],
  782. 'receiver' => [
  783. 'name' => 'test',
  784. 'city' => '厦门市',
  785. 'address' => '思明区',
  786. 'address_detail' => '软件园二期',
  787. 'phone' => '19959271111',
  788. 'lng' => 118.134343,
  789. 'lat' => 24.493566,
  790. 'coordinate_type' => 0,
  791. ],
  792. 'cargo' => [
  793. 'goods_value' => 1,
  794. 'goods_weight' => 0.1,
  795. 'cargo_first_class' => '鲜花',
  796. 'cargo_second_class' => '鲜花',
  797. ],
  798. 'order_info' => [
  799. 'order_type' => 0,
  800. ],
  801. 'shop' => [
  802. 'wxa_path' => '/shop',
  803. 'img_url' => 'http://www.baidu.com/test.png',
  804. 'goods_name' => 'test',
  805. 'goods_count' => 1,
  806. ],
  807. ];
  808. $r = miniUtil::addOrder($data, $merchant, $isOpen);
  809. dd($r);
  810. }
  811. //获取运单数据
  812. /**
  813. * Array
  814. * (
  815. * [resultcode] => 0
  816. * [resultmsg] => ok
  817. * [order_status] => 101
  818. * [agent_info] => Array
  819. * (
  820. * )
  821. *
  822. * [waybill_id] => test_shop_id1612365974_waybillid
  823. * [rider_name] =>
  824. * [rider_phone] =>
  825. * [order_token] => NsXweKCKhSyAEIhAdnX3TYZsVDES0-t-tymHDONG0MpRsF31dQvVxiP_JJvLFaKS-kwXuOG3D0hzKkl7o-gzew
  826. * )
  827. */
  828. public function actionGetOrder()
  829. {
  830. $shopId = 'test_shop_id';
  831. $shopOrderId = 'test_shop_id1612365974';
  832. $appSecret = 'test_app_secrect';
  833. $merchant = WxOpenClass::getGhsWxInfo();
  834. $isOpen = 2;
  835. $data = [
  836. 'shopid' => $shopId,
  837. 'shop_order_id' => $shopOrderId,
  838. 'shop_no' => '1',
  839. 'delivery_sign' => MiniExpressService::getDeliverySign($shopId, $shopOrderId, $appSecret),
  840. ];
  841. $r = miniUtil::getOrder($data, $merchant, $isOpen);
  842. dd($r);
  843. }
  844. //沙盒 更新快递状态
  845. public function actionMockUpdateOrder()
  846. {
  847. $merchant = WxOpenClass::getGhsWxInfo();
  848. $isOpen = 2;
  849. /**
  850. * {
  851. * "shopid": "test_shop_id",
  852. * "shop_order_id": "xxxxxxxxxxx",
  853. * "waybill_id": "xxxxxxxxxxxxx",
  854. * "action_time": 12345678,
  855. * "order_status": 101,
  856. * "action_msg": "",
  857. * }
  858. */
  859. $shopId = 'test_shop_id';
  860. $shopOrderId = 'test_shop_id1612365974';
  861. $data = [
  862. 'shop_order_id' => $shopOrderId,
  863. "shopid" => $shopId,
  864. "action_time" => time(),
  865. "order_status" => 302,
  866. 'action_msg' => '状态变更',
  867. ];
  868. $r = miniUtil::mockUpdateOrder($data, $merchant, $isOpen);
  869. dd($r);
  870. }
  871. public function actionTest()
  872. {
  873. }
  874. //新增订单
  875. public function actionAddOrder()
  876. {
  877. $dada = Yii::getAlias("@vendor/dada/");
  878. require_once $dada . 'api/addOrderApi.php';
  879. require_once $dada . 'client/dadaRequestClient.php';
  880. require_once $dada . 'client/dadaResponse.php';
  881. require_once $dada . 'config/config.php';
  882. require_once $dada . 'model/orderModel.php';
  883. // isOnline 判断是否是测试环境,会有不同的域名等
  884. $isOnline = false;
  885. $sourceId = 1000000;
  886. // 初始化一个config
  887. $config = new \Config($sourceId, $isOnline);
  888. $orderModel = new \OrderModel();
  889. $orderModel->setShopNo('11047059');
  890. $orderModel->setOriginId('2018091100000002');
  891. $orderModel->setCityCode('021');
  892. $orderModel->setCargoPrice(10);
  893. $orderModel->setIsPrepay(0);
  894. $orderModel->setReceiverName('测试达达');
  895. $orderModel->setReceiverAddress('上海市崇明岛');
  896. $orderModel->setReceiverLat(31.63);
  897. $orderModel->setReceiverLng(121.41);
  898. $orderModel->setReceiverPhone('18588888888');
  899. $orderModel->setCallback('http://api.b.huaml.com/data/request');
  900. // api主要有2个参数,一个是url, 一个是业务参数
  901. $addOrderApi = new \AddOrderApi(json_encode($orderModel));
  902. $dada_client = new \DadaRequestClient($config, $addOrderApi);
  903. $resp = $dada_client->makeRequest();
  904. echo json_encode($resp);
  905. }
  906. //订单详情查询
  907. public function actionOrderQuery()
  908. {
  909. $dada = Yii::getAlias("@vendor/dada/");
  910. require_once $dada . 'api/OrderQueryApi.php';
  911. require_once $dada . 'client/dadaRequestClient.php';
  912. require_once $dada . 'client/dadaResponse.php';
  913. require_once $dada . 'config/config.php';
  914. require_once $dada . 'model/orderModel.php';
  915. // isOnline 判断是否是测试环境,会有不同的域名等
  916. $isOnline = false;
  917. $sourceId = 1000000;
  918. // 初始化一个config
  919. $config = new \Config($sourceId, $isOnline);
  920. $orderModel = new \OrderModel();
  921. $orderModel->setOrderId('2018091100000002');
  922. // api主要有2个参数,一个是url, 一个是业务参数
  923. $addOrderApi = new \OrderQueryApi(json_encode($orderModel));
  924. $dada_client = new \DadaRequestClient($config, $addOrderApi);
  925. $resp = $dada_client->makeRequest();
  926. echo json_encode($resp);
  927. }
  928. public function actionFocus()
  929. {
  930. $name = '花卉宝';
  931. if (getenv('YII_ENV') == 'dev') {
  932. $name = '花美灵';
  933. }
  934. $merchant = MerchantService::getByCondition(['name' => $name]);
  935. $list = wxUtil::getSubscribeUserList($merchant);
  936. dd($list);
  937. }
  938. //宝贝售出提醒 ssh 2020.1.30
  939. public function actionInform()
  940. {
  941. $merchant = MerchantService::getMerchantById(12362);
  942. $order = OrderService::getById(214810);
  943. InformAdminClass::sendComplete($order);
  944. }
  945. public function actionNotice()
  946. {
  947. $data = ['messageType' => 'inform', 'informWay' => 'wx', 'userType' => 'admin', 'id' => 6, 'mobile' => '15280215347'];
  948. $producer = Yii::$app->rabbitmq->getProducer('informProducer');
  949. echo '<pre>';
  950. print_r($data);
  951. $msg = serialize($data);
  952. $r = $producer->publish($msg, 'informExchange', 'informRoute');
  953. }
  954. }