queue.logic.php 30 KB

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