queue.logic.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845
  1. <?php
  2. /**
  3. * 队列
  4. *
  5. * 方法名需要和 QueueClient::push中第一个参数一致,如:
  6. * QueueClient::push('editGroupbuySaleCount',$groupbuy_info);
  7. * public function editGroupbuySaleCount($groupbuy_info){...}
  8. *
  9. */
  10. defined('InShopNC') or exit('Access Invalid!');
  11. require_once (BASE_ROOT_PATH . '/helper/push_sender.php');
  12. require_once (BASE_ROOT_PATH . '/helper/sms_helper.php');
  13. require_once (BASE_ROOT_PATH . '/helper/kdn_helper.php');
  14. require_once (BASE_ROOT_PATH . '/helper/statistics_helper.php');
  15. require_once (BASE_ROOT_PATH . '/helper/member_helper.php');
  16. require_once (BASE_ROOT_PATH . '/helper/account_helper.php');
  17. require_once (BASE_ROOT_PATH . '/helper/fcode/generator.php');
  18. require_once (BASE_ROOT_PATH . '/helper/memsg/message_sender.php');
  19. require_once (BASE_ROOT_PATH . '/helper/login_helper.php');
  20. require_once (BASE_ROOT_PATH . '/helper/fcode/mfcode.php');
  21. require_once (BASE_ROOT_PATH . '/helper/fcode/operator.php');
  22. require_once (BASE_ROOT_PATH . '/helper/user_session/fcode.php');
  23. require_once (BASE_ROOT_PATH . '/helper/stat_helper.php');
  24. require_once (BASE_ROOT_PATH . '/helper/message/publisher.php');
  25. require_once (BASE_ROOT_PATH . '/helper/search/tcp_client.php');
  26. require_once (BASE_ROOT_PATH . '/helper/ugc_helper.php');
  27. class queueLogic
  28. {
  29. /**
  30. * 添加会员积分
  31. * @param unknown $member_info
  32. */
  33. public function addPoint($member_info)
  34. {
  35. $points_model = Model('points');
  36. $points_model->savePointsLog('login', array('pl_memberid' => $member_info['member_id'], 'pl_membername' => $member_info['member_name']), true);
  37. return callback(true);
  38. }
  39. /**
  40. * 添加会员经验值
  41. * @param unknown $member_info
  42. */
  43. public function addExppoint($member_info)
  44. {
  45. $exppoints_model = Model('exppoints');
  46. $exppoints_model->saveExppointsLog('login', array('exp_memberid' => $member_info['member_id'], 'exp_membername' => $member_info['member_name']), true);
  47. return callback(true);
  48. }
  49. /**
  50. * 更新抢购信息
  51. * @param unknown $groupbuy_info
  52. * @throws Exception
  53. */
  54. public function editGroupbuySaleCount($groupbuy_info)
  55. {
  56. $model_groupbuy = Model('groupbuy');
  57. $data = array();
  58. $data['buyer_count'] = array('exp', 'buyer_count+1');
  59. $data['buy_quantity'] = array('exp', 'buy_quantity+' . $groupbuy_info['quantity']);
  60. $update = $model_groupbuy->editGroupbuy($data, array('groupbuy_id' => $groupbuy_info['groupbuy_id']));
  61. if (!$update) {
  62. return callback(false, '更新抢购信息失败groupbuy_id:' . $groupbuy_info['groupbuy_id']);
  63. } else {
  64. return callback(true);
  65. }
  66. }
  67. /**
  68. * 更新使用的代金券状态
  69. * @param $input_voucher_list
  70. * @throws Exception
  71. */
  72. public function editVoucherState($voucher_list)
  73. {
  74. $model_voucher = Model('voucher');
  75. $send = new memsg\message_sender();
  76. foreach ($voucher_list as $store_id => $voucher_info) {
  77. $update = $model_voucher->editVoucher(array('voucher_state' => 2), array('voucher_id' => $voucher_info['voucher_id']), $voucher_info['voucher_owner_id']);
  78. if ($update) {
  79. // 发送用户店铺消息
  80. $send->set('member_id', $voucher_info['voucher_owner_id']);
  81. $send->set('code', 'voucher_use');
  82. $param = array();
  83. $param['voucher_code'] = $voucher_info['voucher_code'];
  84. $param['voucher_url'] = urlShop('member_voucher', 'index');
  85. $send->send($param);
  86. } else {
  87. return callback(false, '更新代金券状态失败vcode:' . $voucher_info['voucher_code']);
  88. }
  89. }
  90. return callback(true);
  91. }
  92. /**
  93. * 下单变更库存销量
  94. * @param unknown $goods_buy_quantity
  95. */
  96. public function createOrderUpdateStorage($goods_buy_quantity)
  97. {
  98. $model_goods = Model('goods');
  99. foreach ($goods_buy_quantity as $goods_id => $quantity) {
  100. $data = array();
  101. $data['goods_storage'] = array('exp', 'goods_storage-' . $quantity);
  102. $data['goods_salenum'] = array('exp', 'goods_salenum+' . $quantity);
  103. $result = $model_goods->editGoodsById($data, $goods_id);
  104. }
  105. if (!$result) {
  106. return callback(false, '变更商品库存与销量失败');
  107. } else {
  108. return callback(true);
  109. }
  110. }
  111. /**
  112. * 取消订单变更库存销量
  113. * @param unknown $goods_buy_quantity
  114. */
  115. public function cancelOrderUpdateStorage($goods_buy_quantity)
  116. {
  117. $model_goods = Model('goods');
  118. foreach ($goods_buy_quantity as $goods_id => $quantity) {
  119. $data = array();
  120. $data['goods_storage'] = array('exp', 'goods_storage+' . $quantity);
  121. $data['goods_salenum'] = array('exp', 'goods_salenum-' . $quantity);
  122. $result = $model_goods->editGoodsById($data, $goods_id);
  123. }
  124. if (!$result) {
  125. return callback(false, '变更商品库存与销量失败');
  126. } else {
  127. return callback(true);
  128. }
  129. }
  130. /**
  131. * 更新F码为使用状态
  132. * @param int $fc_id
  133. */
  134. public function updateGoodsFCode($fc_ids)
  135. {
  136. $update = Model('goods_fcode')->editGoodsFCode(array('fc_state' => 1,'consume_time' => time()), array('fc_id' => array('in',$fc_ids)));
  137. if (!$update) {
  138. return callback(false, '更新F码使用状态失败fc_ids:' . implode(',',$fc_ids));
  139. } else {
  140. return callback(true);
  141. }
  142. }
  143. /**
  144. * 删除购物车
  145. * @param unknown $cart
  146. */
  147. public function delCart($cart)
  148. {
  149. if (!is_array($cart['cart_ids']) || empty($cart['buyer_id'])) return callback(true);
  150. $del = Model('cart')->delCart('db', array('buyer_id' => $cart['buyer_id'], 'cart_id' => array('in', $cart['cart_ids'])));
  151. if (!$del) {
  152. return callback(false, '删除购物车数据失败');
  153. } else {
  154. return callback(true);
  155. }
  156. }
  157. /**
  158. * 根据商品id更新促销价格
  159. *
  160. * @param int /array $goods_commonid
  161. * @return boolean
  162. */
  163. public function updateGoodsPromotionPriceByGoodsId($goods_id)
  164. {
  165. $update = Model('goods')->editGoodsPromotionPrice(array('goods_id' => array('in', $goods_id)));
  166. if (!$update) {
  167. return callback(false, '根据商品ID更新促销价格失败');
  168. } else {
  169. return callback(true);
  170. }
  171. }
  172. /**
  173. * 根据商品公共id更新促销价格
  174. *
  175. * @param int /array $goods_commonid
  176. * @return boolean
  177. */
  178. public function updateGoodsPromotionPriceByGoodsCommonId($goods_commonid)
  179. {
  180. $update = Model('goods')->editGoodsPromotionPrice(array('goods_commonid' => array('in', $goods_commonid)));
  181. if (!$update) {
  182. return callback(false, '根据商品公共id更新促销价格失败');
  183. } else {
  184. return callback(true);
  185. }
  186. }
  187. /**
  188. * 发送店铺消息
  189. */
  190. public function sendStoreMsg($param)
  191. {
  192. $send = new sendStoreMsg();
  193. $send->set('code', $param['code']);
  194. $send->set('store_id', $param['store_id']);
  195. $send->send($param['param']);
  196. return callback(true);
  197. }
  198. /**
  199. * 发送会员消息
  200. */
  201. public function sendMemberMsg($param)
  202. {
  203. $send = new memsg\message_sender();
  204. $send->set('code', $param['code']);
  205. $send->set('member_id', $param['member_id']);
  206. $send->set('sms_param', $param['sms_param']);
  207. if (!empty($param['number']['mobile'])) $send->set('mobile', $param['number']['mobile']);
  208. if (!empty($param['number']['email'])) $send->set('email', $param['number']['email']);
  209. $send->send($param['param']);
  210. return callback(true);
  211. }
  212. /**
  213. * 生成商品F码
  214. */
  215. public function createGoodsFCode($param)
  216. {
  217. Log::record("createGoodsFCode {$param['goods_commonid']},{$param['fc_count']},{$param['fc_prefix']},{$param['fc_validate']}",Log::DEBUG);
  218. $gen = new fcode\generator($param['goods_commonid'],$param['fc_count'],$param['fc_prefix'],$param['fc_validate']);
  219. $url = $gen->make();
  220. Log::record("createGoodsFCode url={$url}",Log::DEBUG);
  221. return callback(true);
  222. }
  223. /**
  224. * 生成商品二维码
  225. */
  226. public function createGoodsQRCode($param)
  227. {
  228. if (empty($param['goodsid_array'])) {
  229. return callback(true);
  230. }
  231. // 生成商品二维码
  232. require_once(BASE_RESOURCE_PATH . DS . 'phpqrcode' . DS . 'index.php');
  233. $PhpQRCode = new PhpQRCode();
  234. $PhpQRCode->set('pngTempDir', BASE_UPLOAD_PATH . DS . ATTACH_STORE . DS . $param['store_id'] . DS);
  235. foreach ($param['goodsid_array'] as $goods_id) {
  236. // 生成商品二维码
  237. $PhpQRCode->set('date', urlShop('goods', 'index', array('goods_id' => $goods_id)));
  238. $PhpQRCode->set('pngTempName', $goods_id . '.png');
  239. $PhpQRCode->init();
  240. }
  241. return callback(true);
  242. }
  243. /**
  244. * 清理特殊商品促销信息
  245. */
  246. public function clearSpecialGoodsPromotion($param)
  247. {
  248. // 抢购
  249. Model('groupbuy')->delGroupbuy(array('goods_commonid' => $param['goods_commonid']));
  250. // 显示折扣
  251. Model('p_xianshi_goods')->delXianshiGoods(array('goods_id' => array('in', $param['goodsid_array'])));
  252. // 优惠套装
  253. Model('p_bundling')->delBundlingGoods(array('goods_id' => array('in', $param['goodsid_array'])));
  254. // 更新促销价格
  255. Model('goods')->editGoods(array('goods_promotion_price' => array('exp', 'goods_price'), 'goods_promotion_type' => 0), array('goods_commonid' => $param['goods_commonid']));
  256. return callback(true);
  257. }
  258. /**
  259. * 删除(买/卖家)订单全部数量缓存
  260. * @param array $data 订单信息
  261. * @return boolean
  262. */
  263. public function delOrderCountCache($order_info)
  264. {
  265. if (empty($order_info)) return callback(true);
  266. $model_order = Model('order');
  267. if ($order_info['order_id']) {
  268. $order_info = $model_order->getOrderInfo(array('order_id' => $order_info['order_id']), array(), 'buyer_id,store_id');
  269. }
  270. $model_order->delOrderCountCache('buyer', $order_info['buyer_id']);
  271. $model_order->delOrderCountCache('store', $order_info['store_id']);
  272. return callback(true);
  273. }
  274. /**
  275. * 发送兑换码
  276. * @param unknown $param
  277. * @return boolean
  278. */
  279. public function sendVrCode($param)
  280. {
  281. if (empty($param) && !is_array($param)) return callback(true);
  282. $condition = array();
  283. $condition['order_id'] = $param['order_id'];
  284. $condition['buyer_id'] = $param['buyer_id'];
  285. $condition['vr_state'] = 0;
  286. $condition['refund_lock'] = 0;
  287. $code_list = Model('vr_order')->getOrderCodeList($condition, 'vr_code,vr_indate');
  288. if (empty($code_list)) return callback(true);
  289. $content = '';
  290. foreach ($code_list as $v) {
  291. $content .= $v['vr_code'] . ',';
  292. }
  293. $tpl_info = Model('mail_templates')->getTplInfo(array('code' => 'send_vr_code'));
  294. $data = array();
  295. $data['site_name'] = C('site_name');
  296. $data['vr_code'] = rtrim($content, ',');
  297. $message = ncReplaceText($tpl_info['content'], $data);
  298. $sms = new Sms();
  299. $result = $sms->send($param["buyer_phone"], $message);
  300. if (!$result) {
  301. return callback(false, '兑换码发送失败order_id:' . $param['order_id']);
  302. } else {
  303. return callback(true);
  304. }
  305. }
  306. /**
  307. * 添加订单自提表内容
  308. */
  309. public function saveDeliveryOrder($param)
  310. {
  311. if (!is_array($param['order_sn_list'])) return callback(true);
  312. $data = array();
  313. $model_delivery_order = Model('delivery_order');
  314. foreach ($param['order_sn_list'] as $order_id => $v) {
  315. $data['order_id'] = $order_id;
  316. $data['order_sn'] = $v['order_sn'];
  317. $data['addtime'] = $v['add_time'];
  318. $data['dlyp_id'] = $param['dlyp_id'];
  319. $data['reciver_name'] = $param['reciver_name'];
  320. $data['reciver_telphone'] = $param['tel_phone'];
  321. $data['reciver_mobphone'] = $param['mob_phone'];
  322. $insert = $model_delivery_order->addDeliveryOrder($data);
  323. if (!$insert) {
  324. return callback(false, '保存自提站订单信息失败order_sn:' . $v['order_sn']);
  325. }
  326. }
  327. return callback(true);
  328. }
  329. /**
  330. * 发送提货码短信消息
  331. */
  332. public function sendPickupcode($param)
  333. {
  334. $dorder_info = Model('delivery_order')->getDeliveryOrderInfo(array('order_id' => $param['order_id']), 'reciver_mobphone');
  335. $tpl_info = Model('mail_templates')->getTplInfo(array('code' => 'send_pickup_code'));
  336. $data = array();
  337. $data['site_name'] = C('site_name');
  338. $data['pickup_code'] = $param['pickup_code'];
  339. $message = ncReplaceText($tpl_info['content'], $data);
  340. $sms = new Sms();
  341. $result = $sms->send($dorder_info['reciver_mobphone'], $message);
  342. if (!$result) {
  343. return callback(false, '发送提货码短信消息失败order_id:' . $param['order_id']);
  344. } else {
  345. return callback(true);
  346. }
  347. }
  348. /**
  349. * 刷新搜索索引
  350. */
  351. public function flushIndexer()
  352. {
  353. require_once(BASE_DATA_PATH . '/api/xs/lib/XS.php');
  354. $obj_doc = new XSDocument();
  355. $obj_xs = new XS(C('fullindexer.appname'));
  356. $obj_xs->index->flushIndex();
  357. }
  358. /**
  359. * 推送服务
  360. * @param $param array
  361. * 共有三个key : member_id , text, go_type
  362. * @return bool
  363. */
  364. public function upushSendMsg($param)
  365. {
  366. if (empty($param) || empty($param['alias']) || empty($param['text'])) {
  367. Log::record("push info: 数据有误! param:" . json_encode($param) . "\t session:" . json_encode($_SESSION));
  368. return callback(false);
  369. }
  370. $push = new push_sender();
  371. $push->send($param);
  372. return callback(true);
  373. }
  374. public function sendPushMessage($param)
  375. {
  376. $push = new push_sender();
  377. $push->send_message($param);
  378. return callback(true);
  379. }
  380. /**
  381. * 发短信
  382. * @param $param
  383. *
  384. * @return bool
  385. */
  386. public function sendSMS($param)
  387. {
  388. if (empty($param) || empty($param['mobile']) || empty($param['type'])) {
  389. Log::record("sms info: 数据有误! param:" . json_encode($param),Log::ERR);
  390. return callback(false);
  391. }
  392. try {
  393. $sms = new Sms();
  394. $status = $sms->send($param['mobile'], $param);
  395. Log::record("sms info: status:" . json_encode($status) . "\t param:" . json_encode($param),Log::DEBUG);
  396. } catch (Exception $e) {
  397. Log::record("sms info: fall error\treturn:" . $e->getMessage() . "\t param:" . json_encode($param),Log::ERR);
  398. }
  399. return callback(true);
  400. }
  401. public function sendOperSMS($params)
  402. {
  403. if (empty($params) || empty($params['mobile']) || empty($params['type'])) {
  404. Log::record("sms info: 数据有误! param:" . json_encode($params),Log::ERR);
  405. return callback(false);
  406. }
  407. try
  408. {
  409. $datas = [];
  410. foreach ($params as $key => $val)
  411. {
  412. if($key == 'mobile') {
  413. $mobile = $val;
  414. }
  415. elseif ($key == 'type') {
  416. $type = $val;
  417. }
  418. else {
  419. $datas[$key] = $val;
  420. }
  421. }
  422. $sms = new Sms();
  423. $status = $sms->send_oper($mobile,$type,$datas);
  424. Log::record("sms info: status:" . json_encode($status) . "\t param:" . json_encode($params),Log::DEBUG);
  425. } catch (Exception $e) {
  426. Log::record("sms info: fall error\treturn:" . $e->getMessage() . "\t param:" . json_encode($params),Log::ERR);
  427. }
  428. return callback(true);
  429. }
  430. public function sendBonusAndSMS($params)
  431. {
  432. $input_type = $params['member']['input_type'];
  433. if($input_type == 'mobiles') {
  434. $members = member_helper::from_mobiles($params['member']['data'],$error);
  435. }
  436. elseif($input_type == 'sql') {
  437. $members = member_helper::from_sql($params['member']['data']);
  438. }
  439. else {
  440. return callback(false,'sendBonusAndSMS 错误的人员输入类型.');
  441. }
  442. $fSendSms = $params['sms']['open'];
  443. $smscode = $params['sms']['template_id'];
  444. $rate = $params['bonus']['rate'];
  445. $bless = $params['bonus']['bless'];
  446. $amount = $params['bonus']['amount'];
  447. $can_share = intval($params['bonus']['can_share']);
  448. $chunks = array_chunk($members,1000);
  449. foreach ($chunks as $chunk)
  450. {
  451. $chunk = member_helper::exmembers($chunk,$params['member']['ex_lrlz'],$params['member']['ex_brand']);
  452. $ids = [];
  453. foreach ($chunk as $member) {
  454. $ids[] = $member['member_id'];
  455. }
  456. $ret = account_helper::add_bonus($rate,$amount,$ids,$bless,$can_share);
  457. if($ret == false) continue;
  458. if($fSendSms)
  459. {
  460. $iconut = 0;
  461. $sms = new Sms();
  462. foreach ($chunk as $member)
  463. {
  464. $mobile = $member['member_mobile'];
  465. try {
  466. $status = $sms->send_oper($mobile, $smscode);
  467. Log::record("sms info: status:" . json_encode($status),Log::DEBUG);
  468. } catch (Exception $e) {
  469. Log::record("sms info: fall error\treturn:" . $e->getMessage(),Log::ERR);
  470. }
  471. ++$iconut;
  472. if($iconut == 10) {
  473. sleep(2);
  474. $iconut = 0;
  475. }
  476. }
  477. }
  478. }
  479. return callback(true);
  480. }
  481. public function sendPushOrSMS($params)
  482. {
  483. $input_type = $params['member']['input_type'];
  484. if($input_type == 'mobiles') {
  485. $members = member_helper::from_mobiles($params['member']['data'],$error);
  486. }
  487. elseif($input_type == 'sql') {
  488. $members = member_helper::from_sql($params['member']['data']);
  489. }
  490. else {
  491. return callback(false,'sendBonusAndSMS 错误的人员输入类型.');
  492. }
  493. $send_type = $params['send']['type'];
  494. $content = $params['send']['data'];
  495. $chunks = array_chunk($members,1000);
  496. foreach ($chunks as $chunk)
  497. {
  498. $chunk = member_helper::exmembers($chunk,$params['member']['ex_lrlz'],$params['member']['ex_brand']);
  499. if($send_type == 'sms')
  500. {
  501. $iconut = 0;
  502. $sms = new Sms();
  503. foreach ($chunk as $member)
  504. {
  505. try {
  506. $mobile = $member['member_mobile'];
  507. $status = $sms->send_oper($mobile, $content);
  508. Log::record("sms info: status:" . json_encode($status),Log::DEBUG);
  509. } catch (Exception $e) {
  510. Log::record("sms info: fall error\treturn:" . $e->getMessage(),Log::ERR);
  511. }
  512. ++$iconut;
  513. if($iconut == 10) {
  514. sleep(2);
  515. $iconut = 0;
  516. }
  517. }
  518. }
  519. elseif($send_type == 'push')
  520. {
  521. foreach ($chunk as $member) {
  522. push_helper::oper_push($member['member_id'], $content);
  523. }
  524. }
  525. else {
  526. }
  527. }
  528. return callback(true);
  529. }
  530. /**
  531. * 订阅快递鸟
  532. * @param $param
  533. *
  534. * @return bool
  535. */
  536. public function subscribeKDN($param)
  537. {
  538. if (empty($param) || empty($param['order_sn'])) {
  539. Log::record("kdn_helper: 数据有误! param:" . json_encode($param));
  540. return callback(false);
  541. }
  542. try {
  543. kdn_helper_back::subscribe($param['order_sn']);
  544. } catch (Exception $e) {
  545. Log::record("kdn_helper: fall error\treturn:" . $e->getMessage() . "\t param:" . json_encode($param));
  546. }
  547. return callback(true);
  548. }
  549. /**
  550. * 根据上传的通讯录生成好友关系
  551. */
  552. public function generateRelations($param)
  553. {
  554. if (empty($param["member_id"])) {
  555. return false;
  556. }
  557. try {
  558. Model("mobile_contacts")->genRelations($param["member_id"]);
  559. } catch (Exception $e) {
  560. Log::record("generateRelations: fall error\treturn:" . $e->getMessage());
  561. }
  562. return true;
  563. }
  564. public function savelog($param)
  565. {
  566. statistics_helper::instance()->add_logs($param);
  567. return callback(true);
  568. }
  569. public function click_goods($param)
  570. {
  571. $goods_id = intval($param['goods_id']);
  572. if($goods_id > 0) {
  573. $mod_goods = Model('goods');
  574. $mod_goods->editGoodsById(array('goods_click' => array('exp', 'goods_click + 1')), $goods_id);
  575. return callback(true);
  576. }
  577. else {
  578. return callback(false,"click_goods 错误的goods_id");
  579. }
  580. }
  581. public function reset_fcode($param)
  582. {
  583. $pay_sn = $param['pay_sn'];
  584. if(empty($pay_sn)) {
  585. return callback(false);
  586. }
  587. $num = \fcode\operator::reset($pay_sn);
  588. if($num > 0) {
  589. return callback(true);
  590. } else {
  591. return callback(false);
  592. }
  593. }
  594. public function onUseBonus($param)
  595. {
  596. stat_helper::onUseBonus($param);
  597. return callback(true);
  598. }
  599. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  600. public function onAsyncRegister($param)
  601. {
  602. $user = $param['user'];
  603. $inviter = $param['inviter'];
  604. if($user < 0) {
  605. return callback(false,"onRegisterFromBonus 错误的member_id");
  606. }
  607. account_helper::onAsyncRegister($user,$inviter);
  608. return callback(true);
  609. }
  610. public function onAsyncStatus($param)
  611. {
  612. Log::record(__METHOD__,Log::DEBUG);
  613. account_helper::onAsyncStatus($param['member_id']);
  614. return callback(true);
  615. }
  616. public function onAsyncTopup($param)
  617. {
  618. Log::record(__METHOD__,Log::DEBUG);
  619. account_helper::onAsyncTopup($param['member_id']);
  620. return callback(true);
  621. }
  622. public function onPredeposit($param)
  623. {
  624. Log::record('queue::onPredeposit',Log::DEBUG);
  625. account_helper::onPredeposit($param['change_type'],$param['buyer_id'],$param['order_sn']);
  626. return callback(true);
  627. }
  628. public function onAsyncOrderPaied($param)
  629. {
  630. $pay_sn = $param['pay_sn'];
  631. account_helper::onAsyncOrderPaied($pay_sn);
  632. return callback(true);
  633. }
  634. public function onAsyncOrderSended($param)
  635. {
  636. $pay_sn = $param['pay_sn'];
  637. $logistics_no = $param['logistics_no'];
  638. $logistics_company = $param['logistics_company'];
  639. account_helper::onAsyncOrderSended($pay_sn,$logistics_no,$logistics_company);
  640. return callback(true);
  641. }
  642. public function onAsyncOrderComplete($param)
  643. {
  644. $pay_sn = $param['pay_sn'];
  645. if(!empty($pay_sn)) {
  646. account_helper::onAsyncOrderComplete($pay_sn);
  647. }
  648. return callback(true);
  649. }
  650. public function onAsyncOrderCancel($param)
  651. {
  652. $pay_sn = $param['pay_sn'];
  653. if(!empty($pay_sn)) {
  654. account_helper::onAsyncOrderCancel($pay_sn);
  655. }
  656. return callback(true);
  657. }
  658. public function onAsyncOrderEvaluate($param)
  659. {
  660. $pay_sn = $param['pay_sn'];
  661. if(!empty($pay_sn)) {
  662. account_helper::onAsyncOrderEvaluate($pay_sn);
  663. }
  664. return callback(true);
  665. }
  666. public function onAsyncBroadcastOrder($param)
  667. {
  668. $pay_sn = $param['pay_sn'];
  669. $amount = $param['amount'];
  670. $days = $param['days'];
  671. if(!empty($pay_sn) && !empty($amount)) {
  672. account_helper::onAsyncBroadcastOrder($pay_sn,$amount,$days);
  673. }
  674. return callback(true);
  675. }
  676. public function onAsyncBroadcastNormal($param)
  677. {
  678. $filters = $param['filters'];
  679. $oper_param = $param['oper_param'];
  680. $send_params = $param['send_params'];
  681. if(!empty($oper_param) && !empty($filters) && !empty($send_params)) {
  682. account_helper::onAsyncBroadcastNormal($filters,$oper_param,$send_params);
  683. }
  684. return callback(true);
  685. }
  686. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  687. public function onAsyncUgcPublish($param)
  688. {
  689. $spid = $param['special_id'];
  690. account_helper::onAsyncUgcPublish($spid);
  691. return callback(true);
  692. }
  693. public function onAsyncUgcDel($param)
  694. {
  695. $spid = $param['special_id'];
  696. account_helper::onAsyncUgcDel($spid);
  697. return callback(true);
  698. }
  699. public function onAsyncUgcSubmit($param)
  700. {
  701. $spid = $param['special_id'];
  702. $user = $param['user_id'];
  703. account_helper::onAsyncUgcSubmit($spid,$user);
  704. return callback(true);
  705. }
  706. public function onAsyncUgcSupport($param)
  707. {
  708. $spid = $param['special_id'];
  709. $user = $param['user_id'];
  710. $comment_id = $param['comment_id'];
  711. account_helper::onAsyncUgcSupport($spid,$comment_id,$user);
  712. return callback(true);
  713. }
  714. public static function onAsyncUgcAppreciate($param)
  715. {
  716. $spid = $param['special_id'];
  717. $user = $param['user_id'];
  718. $rate = $param['rate'];
  719. $amount = $param['amount'];
  720. account_helper::onAsyncUgcAppreciate($spid,$user,$rate,$amount);
  721. return callback(true);
  722. }
  723. public function onAsyncUgcComment($param)
  724. {
  725. $special_id = intval($param['special_id']);
  726. $comment_id = intval($param['comment_id']);
  727. $user_id = intval($param['user_id']);
  728. account_helper::onAsyncUgcComment($special_id,$comment_id,$user_id);
  729. return callback(true);
  730. }
  731. public function onClickSpecial($param)
  732. {
  733. $special_id = intval($param['special_id']);
  734. if($special_id > 0) {
  735. Model()->table('mb_special')->where(['special_id' => $special_id])->update(['clicks' => ['exp', 'clicks + 1']]);
  736. }
  737. return callback(true);
  738. }
  739. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  740. public function onAsyncBargain($param)
  741. {
  742. $type = $param['type'];
  743. $bargain_id = intval($param['bargain_id']);
  744. if(empty($type) || $bargain_id <= 0) {
  745. return callback(false);
  746. }
  747. else {
  748. account_helper::onAsyncBargain($type,$bargain_id);
  749. return callback(true);
  750. }
  751. }
  752. public function UpdateSotreLocation($param)
  753. {
  754. $store_id = intval($param['store_id']);
  755. if($store_id <= 0) {
  756. return callback(false);
  757. }
  758. else {
  759. $ret = geo_helper::instance()->update_store($store_id);
  760. return callback($ret);
  761. }
  762. }
  763. }