TestController.php 42 KB

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