TestController.php 42 KB

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