TestController.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\sj\services\MerchantService;
  4. use bizGhs\express\services\DadaExpressServices;
  5. use bizGhs\order\classes\OrderClass;
  6. use bizHd\message\classes\InformAdminClass;
  7. use bizHd\order\services\OrderService;
  8. use bizHd\wx\classes\WxOpenClass;
  9. use bizGhs\express\services\MiniExpressService;
  10. use common\components\dict;
  11. use common\components\lakala\Lakala;
  12. use common\components\miniUtil;
  13. use common\components\orderSn;
  14. use common\components\wxUtil;
  15. use Yii;
  16. use common\components\util;
  17. class TestController extends BaseController
  18. {
  19. public $guestAccess = ['inform', 'notice', 'order-query', 'add-order', 'index', 'get'];
  20. public function actionGet()
  21. {
  22. ini_set('memory_limit', '2045M');
  23. set_time_limit(0);
  24. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  25. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  26. $arr = [
  27. //['name' => '国兰花尚OK', 'merchantNo' => '82239305992006L', 'wx' => [600913569, 600907053], 'zfb' => '2088820709029782'],
  28. //['name' => '花掌柜OK', 'merchantNo' => '82240505992000P', 'wx' => [600466131, 600465187], 'zfb' => '2088820656569304'],
  29. //['name' => '纯彩花艺OK', 'merchantNo' => '82239305992006M', 'wx' => [600922790, 600915407], 'zfb' => '2088820710146836'],
  30. //['name' => '集美天天鲜花OK', 'merchantNo' => '82239305992006P', 'wx' => [601036538, 601036322], 'zfb' => '2088820726763339'],
  31. //['name' => '丰行花行OK', 'merchantNo' => '82260205992007P', 'wx' => [601053759, 601052157], 'zfb' => '2088820725885465'],
  32. //['name' => '独家花行OK', 'merchantNo' => '82239305992006Q', 'wx' => [601049483, 601048223], 'zfb' => '2088820725546555'],
  33. //['name' => '好多花海沧OK', 'merchantNo' => '82239305992006R', 'wx' => [601052177, 601053735], 'zfb' => '2088820725549695'],
  34. //['name' => '美天鲜花OK', 'merchantNo' => '82259505992003F', 'wx' => [601062064, 601138175], 'zfb' => '2088820729400990'],
  35. //['name' => '天天陈江店OK', 'merchantNo' => '82259505992003E', 'wx' => [601060616, 601059382], 'zfb' => '2088820725555368'],
  36. //['name' => '叶上花OK', 'merchantNo' => '82231805992002G', 'wx' => [601062892, 601062589], 'zfb' => '2088820728763546'],
  37. //['name' => '好又多(小明)OK', 'merchantNo' => '82239305992006S', 'wx' => [601135715, 601067347], 'zfb' => '2088820729698012'],
  38. //['name' => '我卖花OK', 'merchantNo' => '82227505992000R', 'wx' => [601177139, 601148755], 'zfb' => '2088820746424032'],
  39. //['name' => '问境OK', 'merchantNo' => '8226900599200KX', 'wx' => [601299388, 601299453], 'zfb' => '2088820787661843'],
  40. //['name' => '昱成OK', 'merchantNo' => '8226900599200KY', 'wx' => [601312993, 601325844], 'zfb' => '2088820788900240'],
  41. //['name' => '杭州斗南', 'merchantNo' => '杭州斗南', 'wx' => [601405963, 601405929], 'zfb' => '2088820793601705'],
  42. //['name' => '杭州斗南(没用)', 'merchantNo' => '8223310599200AD', 'wx' => [601254682, 601250805], 'zfb' => '2088820782666872'],
  43. ['name' => '买手很忙', 'merchantNo' => '8227310599200GJ', 'wx' => [601597167, 601595526], 'zfb' => '2088820818930267'],
  44. ['name' => '七彩花都OK', 'merchantNo' => '8227310599200GF', 'wx' => [601176481, 601148503], 'zfb' => '2088820748594478'],
  45. ['name' => '十年OK', 'merchantNo' => '82252305992001U', 'wx' => [601285154, 601261795], 'zfb' => '2088820782171763'],
  46. //['name' => '都市花季OK', 'merchantNo' => '82239305992006U', 'wx' => [601174342, 601147649], 'zfb' => '2088820748507346'],
  47. //['name' => '花样年华OK', 'merchantNo' => '82260205992007Q', 'wx' => [601134352, 601091710], 'zfb' => '2088820735043444'],
  48. //['name' => '精茂城OK', 'merchantNo' => '8225840599200TF', 'wx' => [601173752, 601143352], 'zfb' => '2088820746800005'],
  49. //['name' => '莱漫OK', 'merchantNo' => '82239305992007A', 'wx' => [601288494, 601288166], 'zfb' => '2088820783686611'],
  50. //['name' => '莱漫(没用)', 'merchantNo' => '82239305992006T', 'wx' => [601134065, 601125595], 'zfb' => '2088820743859918'],
  51. //['name' => '福州我要花OK', 'merchantNo' => '82239105992007J', 'wx' => [601134030, 601128111], 'zfb' => '2088820745276973'],
  52. //['name' => '泉城OK', 'merchantNo' => '82239705992004F', 'wx' => [601273270, 601272854], 'zfb' => '2088820784658561'],
  53. //['name' => '泉城(没用)', 'merchantNo' => '82239705992004E', 'wx' => [601133056, 601133821], 'zfb' => '2088820746111323'],
  54. //['name' => '美丽花行OK', 'merchantNo' => '82239305992006V', 'wx' => [601155249, 601149712], 'zfb' => '2088820747673312'],
  55. //['name' => '三叶OK', 'merchantNo' => '82236805992001Y', 'wx' => [601152233, 601151024], 'zfb' => '2088820747556725'],
  56. //['name' => '花大苪OK', 'merchantNo' => '8227310599200GG', 'wx' => [601174221, 601165136], 'zfb' => '2088820751181377'],
  57. //['name' => '十堰天天鲜花OK', 'merchantNo' => '82252305992001S', 'wx' => [601171131, 601170642], 'zfb' => '2088820750844626'],
  58. //['name' => '珑松花卉OK', 'merchantNo' => '82260205992007S', 'wx' => [601176093, 601174262], 'zfb' => '2088820754742492'],
  59. //['name' => '惠雅鲜花OK', 'merchantNo' => '82260205992007R', 'wx' => [601173390, 601174002], 'zfb' => '2088820753174540'],
  60. //['name' => '锦绣花卉OK', 'merchantNo' => '82252305992001T', 'wx' => [601176719, 601176660], 'zfb' => '2088820754751663'],
  61. //['name' => '祥瑞鲜花同安店OK', 'merchantNo' => '82239305992006W', 'wx' => [601178350, 601177795], 'zfb' => '2088820755715024'],
  62. //['name' => '祥瑞鲜花翔安店OK', 'merchantNo' => '82239305992006X', 'wx' => [601178260, 601178199], 'zfb' => '2088820754481553'],
  63. //['name' => '初见花季OK', 'merchantNo' => '82239305992006Y', 'wx' => [601178998, 601179605], 'zfb' => '2088820757223312'],
  64. //['name' => '荣发鲜花OK', 'merchantNo' => '82242705992000D', 'wx' => [601179681, 601179180], 'zfb' => '2088820756926593'],
  65. //['name' => '花千朵(多多)OK', 'merchantNo' => '82239305992006Z', 'wx' => [601223474, 601208096], 'zfb' => '2088820766783276'],
  66. //['name' => '花悠星OK', 'merchantNo' => '8225810599200NH', 'wx' => [601228194, 601227691], 'zfb' => '2088820774587446'],
  67. //['name' => '花悠星(没用)', 'merchantNo' => '8225810599200NG', 'wx' => [601223630, 601210952], 'zfb' => '2088820767072874'],
  68. //['name' => '源花汇OK', 'merchantNo' => '82222105992004A', 'wx' => [601221944, 601214269], 'zfb' => '2088820770594246'],
  69. //['name' => '源花汇2(没用)', 'merchantNo' => '8227310599200GD', 'wx' => [601136305, 601067016], 'zfb' => '2088820729832744'],
  70. ];
  71. $new = [];
  72. foreach ($arr as $item) {
  73. $wx = $item['wx'];
  74. $zfb = $item['zfb'];
  75. $merchantNo = $item['merchantNo'];
  76. $name = $item['name'] . ' ' . $merchantNo;
  77. $group = [];
  78. foreach ($wx as $oneWx) {
  79. $params = [
  80. 'appid' => 'OP00002119',
  81. 'serial_no' => '018b08cfddbd',
  82. 'merchant_no' => $merchantNo,
  83. 'term_no' => 'C6337694',
  84. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  85. 'lklCertificatePath' => $lklCertificatePath,
  86. ];
  87. $data = [
  88. 'subMerchantId' => $oneWx,
  89. 'tradeMode' => 'WECHAT',
  90. ];
  91. $laResource = new Lakala($params);
  92. $response = $laResource->openStateQuery($data);
  93. $statusName = '出错了';
  94. if ($response['retCode'] == '000000') {
  95. $checkResult = $response['respData']['checkResult'] ?? '';
  96. $statusName = '未确认';
  97. if ($checkResult == 'AUTHORIZE_STATE_AUTHORIZED') {
  98. $statusName = '已确认';
  99. }
  100. }
  101. $group[] = '微信 ' . $oneWx . ' ' . $statusName;
  102. }
  103. $params = [
  104. 'appid' => 'OP00002119',
  105. 'serial_no' => '018b08cfddbd',
  106. 'merchant_no' => $merchantNo,
  107. 'term_no' => 'C6337694',
  108. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  109. 'lklCertificatePath' => $lklCertificatePath,
  110. ];
  111. $data = [
  112. 'subMerchantId' => $zfb,
  113. 'tradeMode' => 'ALIPAY',
  114. ];
  115. $laResource = new Lakala($params);
  116. $response = $laResource->openStateQuery($data);
  117. $statusName = '出错了';
  118. if ($response['retCode'] == '000000') {
  119. $checkResult = $response['respData']['checkResult'] ?? '';
  120. $statusName = '未确认';
  121. if ($checkResult == 'AUTHORIZED') {
  122. $statusName = '已确认';
  123. }
  124. }
  125. $group[] = '支付宝 ' . $zfb . ' ' . $statusName;
  126. $new[] = ['name' => $name, 'status' => $group];
  127. }
  128. echo '<pre>';
  129. print_r($new);
  130. die;
  131. }
  132. public function actionAliRun2()
  133. {
  134. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  135. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  136. $params = [
  137. 'appid' => 'OP00002119',
  138. 'serial_no' => '018b08cfddbd',
  139. 'merchant_no' => '82240505992000N',
  140. 'term_no' => 'C6337694',
  141. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  142. 'lklCertificatePath' => $lklCertificatePath,
  143. ];
  144. $outTradeNo = orderSn::getPurchaseSn();
  145. $notifyUrl = Yii::$app->params['hdHost'] . "/notice/pay-callback";
  146. $currentCapitalType = dict::getDict('capitalType', 'xhPurchase', 'id');
  147. $aliParams = [
  148. 'orderSn' => $outTradeNo,
  149. 'amount' => 0.16,
  150. 'capitalType' => $currentCapitalType,
  151. 'notifyUrl' => $notifyUrl,
  152. ];
  153. $laResource = new Lakala($params);
  154. $response = $laResource->driveAliPay($aliParams);
  155. if ($response && isset($response['cmdRetCode']) && $response['cmdRetCode'] == 'GLOBAL_SUCCESS') {
  156. echo '<pre>';
  157. echo "下单成功<br/>";
  158. print_r($response);
  159. } else {
  160. echo '<pre>';
  161. echo "下单失败<br/>";
  162. print_r($response);
  163. }
  164. }
  165. public function actionAliRun3()
  166. {
  167. $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
  168. $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
  169. $params = [
  170. 'appid' => 'OP00002119',
  171. 'serial_no' => '018b08cfddbd',
  172. 'merchant_no' => '82240505992000N',
  173. 'term_no' => 'C6337694',
  174. 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
  175. 'lklCertificatePath' => $lklCertificatePath,
  176. ];
  177. $laResource = new Lakala($params);
  178. $outTradeNo = orderSn::getPurchaseSn();
  179. $notifyUrl = Yii::$app->params['hdHost'] . "/notice/pay-callback";
  180. $currentCapitalType = dict::getDict('capitalType', 'xhPurchase', 'id');
  181. $wxParams = [
  182. 'orderSn' => $outTradeNo,
  183. 'amount' => 0.16,
  184. 'capitalType' => $currentCapitalType,
  185. 'notifyUrl' => $notifyUrl,
  186. ];
  187. $response = $laResource->driveWxPay($wxParams);
  188. if ($response && isset($response['cmdRetCode']) && $response['cmdRetCode'] == 'GLOBAL_SUCCESS') {
  189. echo '<pre>';
  190. echo "下单成功<br/>";
  191. print_r($response);
  192. } else {
  193. echo '<pre>';
  194. echo "下单失败<br/>";
  195. print_r($response);
  196. }
  197. }
  198. //dada 城市code
  199. public function actionDadaCityCode()
  200. {
  201. $res = dada::getCityCode(0);
  202. util::success($res);
  203. }
  204. //理由
  205. public function actionDadaReasons()
  206. {
  207. $res = dada::getCancelReason(0);
  208. util::success($res);
  209. }
  210. //达达 :下单
  211. public function actionDadaAddOrder()
  212. {
  213. $orderSn = 'XSD_CS26316851';
  214. $orderInfo = OrderClass::getByOrderSn($orderSn);
  215. $res = DadaExpressServices::addOrder($orderInfo);
  216. util::success($res);
  217. }
  218. //重发快递
  219. public function actionDadaReAdd()
  220. {
  221. $orderSn = 'XSD_CS26316851';
  222. $orderInfo = OrderClass::getByOrderSn($orderSn);
  223. $res = DadaExpressServices::reAddOrder($orderInfo);
  224. util::success($res);
  225. }
  226. //达达状态查询
  227. public function actionDadaOrderStatus()
  228. {
  229. $orderSn = 'XSD_CS26316851';
  230. $res = DadaExpressServices::statusOrder($orderSn);
  231. util::success($res);
  232. }
  233. //达达取消下单
  234. public function actionDadaCancelOrder()
  235. {
  236. $orderSn = 'XSD_CS26316851';
  237. $res = DadaExpressServices::cancelOrder($orderSn, 1);
  238. util::success($res);
  239. }
  240. //获取已支持的配送公司列表接口
  241. public function actionGetAllDelivery()
  242. {
  243. $data = MiniExpressService::getAllImmeDelivery();
  244. util::success($data);
  245. }
  246. //即时配送
  247. /*
  248. * Array
  249. (
  250. [resultcode] => 0
  251. [resultmsg] => OK
  252. [shop_list] => Array
  253. (
  254. [0] => Array
  255. (
  256. [shopid] => 1588714266
  257. [delivery_id] => SFTC
  258. [audit_result] => 0
  259. [create_time] => 1612172838
  260. [remark] =>
  261. [delivery_name] => 顺丰同城急送
  262. )
  263. )
  264. )
  265. */
  266. public function actionGetBindAccount()
  267. {
  268. $merchant = WxOpenClass::getGhsWxInfo();
  269. $isOpen = 2;
  270. $r = miniUtil::getBindAccount($merchant, $isOpen);
  271. dd($r);
  272. }
  273. //下单 (沙箱)
  274. /**
  275. * Array
  276. * (
  277. * [resultcode] => 0
  278. * [resultmsg] => ok
  279. * [fee] => 10
  280. * [waybill_id] => test_shop_id1612365974_waybillid
  281. * [order_status] => 101
  282. * [dispatch_duration] => 300
  283. * )
  284. */
  285. public function actionCreateWaybill()
  286. {
  287. $merchant = WxOpenClass::getGhsWxInfo();
  288. $isOpen = 2;
  289. $shopId = 'test_shop_id';
  290. $shopOrderId = 'test_shop_id' . time();
  291. $appSecret = 'test_app_secrect';
  292. $data = [
  293. 'shopid' => $shopId,
  294. 'shop_order_id' => $shopOrderId,
  295. 'shop_no' => '1',
  296. 'delivery_sign' => miniUtil::getDeliverySign($shopId, $shopOrderId, $appSecret), //,则delivery_sign=SHA1(shopid + shop_order_id + AppSecret)
  297. 'delivery_id' => "TEST",
  298. 'openid' => 'oGKMp45YLxewOTWEbpMFzWoVqdW0',
  299. 'sender' => [
  300. 'name' => 'test',
  301. 'city' => '厦门市',
  302. 'address' => '思明区',
  303. 'address_detail' => '软件园二期',
  304. 'phone' => '19959271111',
  305. 'lng' => 118.134343,
  306. 'lat' => 24.483566,
  307. 'coordinate_type' => 0,
  308. ],
  309. 'receiver' => [
  310. 'name' => 'test',
  311. 'city' => '厦门市',
  312. 'address' => '思明区',
  313. 'address_detail' => '软件园二期',
  314. 'phone' => '19959271111',
  315. 'lng' => 118.134343,
  316. 'lat' => 24.493566,
  317. 'coordinate_type' => 0,
  318. ],
  319. 'cargo' => [
  320. 'goods_value' => 1,
  321. 'goods_weight' => 0.1,
  322. 'cargo_first_class' => '鲜花',
  323. 'cargo_second_class' => '鲜花',
  324. ],
  325. 'order_info' => [
  326. 'order_type' => 0,
  327. ],
  328. 'shop' => [
  329. 'wxa_path' => '/shop',
  330. 'img_url' => 'http://www.baidu.com/test.png',
  331. 'goods_name' => 'test',
  332. 'goods_count' => 1,
  333. ],
  334. ];
  335. $r = miniUtil::addOrder($data, $merchant, $isOpen);
  336. dd($r);
  337. }
  338. //获取运单数据
  339. /**
  340. * Array
  341. * (
  342. * [resultcode] => 0
  343. * [resultmsg] => ok
  344. * [order_status] => 101
  345. * [agent_info] => Array
  346. * (
  347. * )
  348. *
  349. * [waybill_id] => test_shop_id1612365974_waybillid
  350. * [rider_name] =>
  351. * [rider_phone] =>
  352. * [order_token] => NsXweKCKhSyAEIhAdnX3TYZsVDES0-t-tymHDONG0MpRsF31dQvVxiP_JJvLFaKS-kwXuOG3D0hzKkl7o-gzew
  353. * )
  354. */
  355. public function actionGetOrder()
  356. {
  357. $shopId = 'test_shop_id';
  358. $shopOrderId = 'test_shop_id1612365974';
  359. $appSecret = 'test_app_secrect';
  360. $merchant = WxOpenClass::getGhsWxInfo();
  361. $isOpen = 2;
  362. $data = [
  363. 'shopid' => $shopId,
  364. 'shop_order_id' => $shopOrderId,
  365. 'shop_no' => '1',
  366. 'delivery_sign' => MiniExpressService::getDeliverySign($shopId, $shopOrderId, $appSecret),
  367. ];
  368. $r = miniUtil::getOrder($data, $merchant, $isOpen);
  369. dd($r);
  370. }
  371. //沙盒 更新快递状态
  372. public function actionMockUpdateOrder()
  373. {
  374. $merchant = WxOpenClass::getGhsWxInfo();
  375. $isOpen = 2;
  376. /**
  377. * {
  378. * "shopid": "test_shop_id",
  379. * "shop_order_id": "xxxxxxxxxxx",
  380. * "waybill_id": "xxxxxxxxxxxxx",
  381. * "action_time": 12345678,
  382. * "order_status": 101,
  383. * "action_msg": "",
  384. * }
  385. */
  386. $shopId = 'test_shop_id';
  387. $shopOrderId = 'test_shop_id1612365974';
  388. $data = [
  389. 'shop_order_id' => $shopOrderId,
  390. "shopid" => $shopId,
  391. "action_time" => time(),
  392. "order_status" => 302,
  393. 'action_msg' => '状态变更',
  394. ];
  395. $r = miniUtil::mockUpdateOrder($data, $merchant, $isOpen);
  396. dd($r);
  397. }
  398. public function actionTest()
  399. {
  400. }
  401. //新增订单
  402. public function actionAddOrder()
  403. {
  404. $dada = Yii::getAlias("@vendor/dada/");
  405. require_once $dada . 'api/addOrderApi.php';
  406. require_once $dada . 'client/dadaRequestClient.php';
  407. require_once $dada . 'client/dadaResponse.php';
  408. require_once $dada . 'config/config.php';
  409. require_once $dada . 'model/orderModel.php';
  410. // isOnline 判断是否是测试环境,会有不同的域名等
  411. $isOnline = false;
  412. $sourceId = 1000000;
  413. // 初始化一个config
  414. $config = new \Config($sourceId, $isOnline);
  415. $orderModel = new \OrderModel();
  416. $orderModel->setShopNo('11047059');
  417. $orderModel->setOriginId('2018091100000002');
  418. $orderModel->setCityCode('021');
  419. $orderModel->setCargoPrice(10);
  420. $orderModel->setIsPrepay(0);
  421. $orderModel->setReceiverName('测试达达');
  422. $orderModel->setReceiverAddress('上海市崇明岛');
  423. $orderModel->setReceiverLat(31.63);
  424. $orderModel->setReceiverLng(121.41);
  425. $orderModel->setReceiverPhone('18588888888');
  426. $orderModel->setCallback('http://api.b.huaml.com/data/request');
  427. // api主要有2个参数,一个是url, 一个是业务参数
  428. $addOrderApi = new \AddOrderApi(json_encode($orderModel));
  429. $dada_client = new \DadaRequestClient($config, $addOrderApi);
  430. $resp = $dada_client->makeRequest();
  431. echo json_encode($resp);
  432. }
  433. //订单详情查询
  434. public function actionOrderQuery()
  435. {
  436. $dada = Yii::getAlias("@vendor/dada/");
  437. require_once $dada . 'api/OrderQueryApi.php';
  438. require_once $dada . 'client/dadaRequestClient.php';
  439. require_once $dada . 'client/dadaResponse.php';
  440. require_once $dada . 'config/config.php';
  441. require_once $dada . 'model/orderModel.php';
  442. // isOnline 判断是否是测试环境,会有不同的域名等
  443. $isOnline = false;
  444. $sourceId = 1000000;
  445. // 初始化一个config
  446. $config = new \Config($sourceId, $isOnline);
  447. $orderModel = new \OrderModel();
  448. $orderModel->setOrderId('2018091100000002');
  449. // api主要有2个参数,一个是url, 一个是业务参数
  450. $addOrderApi = new \OrderQueryApi(json_encode($orderModel));
  451. $dada_client = new \DadaRequestClient($config, $addOrderApi);
  452. $resp = $dada_client->makeRequest();
  453. echo json_encode($resp);
  454. }
  455. public function actionFocus()
  456. {
  457. $name = '花卉宝';
  458. if (getenv('YII_ENV') == 'dev') {
  459. $name = '花美灵';
  460. }
  461. $merchant = MerchantService::getByCondition(['name' => $name]);
  462. $list = wxUtil::getSubscribeUserList($merchant);
  463. dd($list);
  464. }
  465. //宝贝售出提醒 ssh 2020.1.30
  466. public function actionInform()
  467. {
  468. $merchant = MerchantService::getMerchantById(12362);
  469. $order = OrderService::getById(214810);
  470. InformAdminClass::sendComplete($order);
  471. }
  472. public function actionNotice()
  473. {
  474. $data = ['messageType' => 'inform', 'informWay' => 'wx', 'userType' => 'admin', 'id' => 6, 'mobile' => '15280215347'];
  475. $producer = Yii::$app->rabbitmq->getProducer('informProducer');
  476. echo '<pre>';
  477. print_r($data);
  478. $msg = serialize($data);
  479. $r = $producer->publish($msg, 'informExchange', 'informRoute');
  480. }
  481. }