TestController.php 43 KB

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