StoreOrderTakeServices.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\services\order;
  12. use app\dao\order\StoreOrderDao;
  13. use app\jobs\integral\IntegralJob;
  14. use app\jobs\order\AutoTakeOrderJob;
  15. use app\jobs\notice\SmsAdminJob;
  16. use app\services\BaseServices;
  17. use app\services\message\service\StoreServiceServices;
  18. use app\services\message\sms\SmsSendServices;
  19. use app\services\user\member\MemberCardServices;
  20. use app\services\user\UserBillServices;
  21. use app\services\user\UserBrokerageServices;
  22. use app\services\user\level\UserLevelServices;
  23. use app\services\user\UserServices;
  24. use think\exception\ValidateException;
  25. use think\facade\Log;
  26. /**
  27. * 订单收货
  28. * Class StoreOrderTakeServices
  29. * @package app\services\order
  30. * @mixin StoreOrderDao
  31. */
  32. class StoreOrderTakeServices extends BaseServices
  33. {
  34. /**
  35. * 构造方法
  36. * StoreOrderTakeServices constructor.
  37. * @param StoreOrderDao $dao
  38. */
  39. public function __construct(StoreOrderDao $dao)
  40. {
  41. $this->dao = $dao;
  42. }
  43. /**
  44. * 小程序订单服务收货
  45. * @param $order_id
  46. * @return bool
  47. * @throws \think\db\exception\DataNotFoundException
  48. * @throws \think\db\exception\DbException
  49. * @throws \think\db\exception\ModelNotFoundException
  50. */
  51. public function miniOrderTakeOrder($order_id)
  52. {
  53. $orderArr = explode('_', $order_id);
  54. if (count($orderArr) == 2) {
  55. $order_id = $orderArr[1] ?? $order_id;
  56. }
  57. //查找订单信息
  58. $order = $this->dao->getOne(['order_id' => $order_id]);
  59. if (!$order) {
  60. return true;
  61. }
  62. if ($order['pid'] == -1) { // 有子订单
  63. // 查找待收货的子订单
  64. $son_order_list = $this->dao->getSubOrderNotSendList((int)$order['id']);
  65. foreach ($son_order_list as $son_order) {
  66. $this->takeOrder($son_order['order_id'], $son_order['uid']);
  67. }
  68. } else {
  69. $this->takeOrder($order_id, $order['uid']);
  70. }
  71. return true;
  72. }
  73. /**
  74. * 用户订单收货
  75. * @param $uni
  76. * @param $uid
  77. * @return bool
  78. */
  79. public function takeOrder(string $uni, int $uid)
  80. {
  81. $order = $this->dao->getUserOrderDetail($uni, $uid);
  82. if (!$order) {
  83. throw new ValidateException('订单不存在!');
  84. }
  85. /** @var StoreOrderServices $orderServices */
  86. $orderServices = app()->make(StoreOrderServices::class);
  87. $order = $orderServices->tidyOrder($order);
  88. if ($order['_status']['_type'] != 2) {
  89. throw new ValidateException('订单状态错误!');
  90. }
  91. //存在拆分发货 需要分开收货
  92. if ($this->dao->count(['pid' => $order['id']])) {
  93. throw new ValidateException('拆分发货,请去订单详情中包裹确认收货');
  94. }
  95. if ($order['type'] != 8) {
  96. $order->status = 2;
  97. } else {
  98. $order->status = 3;
  99. }
  100. /** @var StoreOrderStatusServices $statusService */
  101. $statusService = app()->make(StoreOrderStatusServices::class);
  102. $res = $order->save() && $statusService->save([
  103. 'oid' => $order['id'],
  104. 'change_type' => 'user_take_delivery',
  105. 'change_message' => '用户已收货',
  106. 'change_time' => time()
  107. ]);
  108. $res = $res && $this->storeProductOrderUserTakeDelivery($order);
  109. if (!$res) {
  110. throw new ValidateException('收货失败');
  111. }
  112. //核销订单 修改订单商品核销状态
  113. if ($order['shipping_type'] == 2 || (in_array($order['shipping_type'], [1, 3]) && $order['delivery_type'] == 'send')) {
  114. //修改原来订单商品信息
  115. $cartData['is_writeoff'] = 1;
  116. $cartData['write_surplus_times'] = 0;
  117. /** @var StoreOrderCartInfoServices $cartInfoServices */
  118. $cartInfoServices = app()->make(StoreOrderCartInfoServices::class);
  119. $cartInfoServices->update(['oid' => $order['id']], $cartData);
  120. }
  121. return $order;
  122. }
  123. /**
  124. * 订单确认收货
  125. * @param $order
  126. * @return bool
  127. */
  128. public function storeProductOrderUserTakeDelivery($order, bool $isTran = true)
  129. {
  130. $res = true;
  131. //获取购物车内的商品标题
  132. /** @var StoreOrderCartInfoServices $orderInfoServices */
  133. $orderInfoServices = app()->make(StoreOrderCartInfoServices::class);
  134. $storeName = $orderInfoServices->getCarIdByProductTitle((int)$order['id']);
  135. $storeTitle = substrUTf8($storeName, 20, 'UTF-8', '');
  136. if ($order['uid']) {
  137. /** @var UserServices $userServices */
  138. $userServices = app()->make(UserServices::class);
  139. $userInfo = $userServices->get((int)$order['uid']);
  140. $res = $this->transaction(function () use ($order, $userInfo, $storeTitle) {
  141. //赠送积分
  142. $res1 = $this->gainUserIntegral($order, $userInfo, $storeTitle);
  143. //返佣
  144. $res2 = $this->backOrderBrokerage($order, $userInfo);
  145. //经验
  146. $res3 = $this->gainUserExp($order, $userInfo);
  147. if (!($res1 && $res2 && $res3)) {
  148. throw new ValidateException('收货失败!');
  149. }
  150. return true;
  151. }, $isTran);
  152. }
  153. if ($res) {
  154. //订单收货事件
  155. event('order.take', [$order, $storeTitle]);
  156. return true;
  157. } else {
  158. return false;
  159. }
  160. }
  161. /**
  162. * 赠送积分
  163. * @param $order
  164. * @param $userInfo
  165. * @param $storeTitle
  166. * @return bool
  167. */
  168. public function gainUserIntegral($order, $userInfo, $storeTitle)
  169. {
  170. $res2 = true;
  171. if (!$userInfo) {
  172. return true;
  173. }
  174. // 营销产品送积分
  175. if (!isset($order['type']) || in_array($order['type'], [1, 2, 3, 5, 8])) {
  176. return true;
  177. }
  178. /** @var UserBillServices $userBillServices */
  179. $userBillServices = app()->make(UserBillServices::class);
  180. $balance = $userInfo['integral'];
  181. if ($order['gain_integral'] > 0) {
  182. $balance = bcadd((string)$balance, (string)$order['gain_integral']);
  183. $res2 = false != $userBillServices->income('pay_give_integral', $order['uid'], (int)$order['gain_integral'], (int)$balance, $order['id']);
  184. }
  185. $order_integral = 0;
  186. $res3 = true;
  187. $order_give_integral = sys_config('order_give_integral');
  188. if ($order['pay_price'] && $order_give_integral) {
  189. //会员消费返积分翻倍
  190. if ($userInfo['is_money_level'] > 0) {
  191. //看是否开启消费返积分翻倍奖励
  192. /** @var MemberCardServices $memberCardService */
  193. $memberCardService = app()->make(MemberCardServices::class);
  194. $integral_rule_number = $memberCardService->isOpenMemberCardCache('integral');
  195. if ($integral_rule_number) {
  196. $order_integral = bcmul((string)$order['pay_price'], (string)$integral_rule_number, 2);
  197. }
  198. }
  199. $order_integral = bcmul((string)$order_give_integral, (string)($order_integral ? $order_integral : $order['pay_price']), 0);
  200. $balance = bcadd((string)$balance, (string)$order_integral);
  201. $res3 = false != $userBillServices->income('order_give_integral', $order['uid'], (int)$order_integral, (int)$balance, $order['id']);
  202. }
  203. $give_integral = $order_integral + $order['gain_integral'];
  204. if ($give_integral > 0) {
  205. $integral = $userInfo['integral'] + $give_integral;
  206. $userInfo->integral = $integral;
  207. $res1 = false != $userInfo->save();
  208. $res = $res1 && $res2 && $res3;
  209. //发送消息
  210. event('notice.notice', [['order' => $order, 'storeTitle' => $storeTitle, 'give_integral' => $give_integral, 'integral' => $integral], 'integral_accout']);
  211. return $res;
  212. }
  213. return true;
  214. }
  215. /**
  216. * 一级返佣
  217. * @param $orderInfo
  218. * @param $userInfo
  219. * @return bool
  220. */
  221. public function backOrderBrokerage($orderInfo, $userInfo)
  222. {
  223. // 当前订单|用户不存在 直接返回
  224. if (!$orderInfo || !$userInfo) {
  225. return true;
  226. }
  227. //商城分销功能是否开启 0关闭1开启
  228. if (!sys_config('brokerage_func_status')) return true;
  229. // 营销产品不返佣金
  230. if (!isset($orderInfo['type']) || in_array($orderInfo['type'], [1, 2, 3, 5, 8])) {
  231. return true;
  232. }
  233. //绑定失效
  234. if (isset($orderInfo['spread_uid']) && $orderInfo['spread_uid'] == -1) {
  235. return true;
  236. }
  237. //是否开启自购返佣
  238. $isSelfBrokerage = sys_config('is_self_brokerage', 0);
  239. if (!isset($orderInfo['spread_uid']) || !$orderInfo['spread_uid']) {//兼容之前订单表没有spread_uid情况
  240. //没开启自购返佣 没有上级 或者 当用用户上级时自己 直接返回
  241. if (!$isSelfBrokerage && (!$userInfo['spread_uid'] || $userInfo['spread_uid'] == $orderInfo['uid'])) {
  242. return true;
  243. }
  244. $one_spread_uid = $isSelfBrokerage ? $userInfo['uid'] : $userInfo['spread_uid'];
  245. } else {
  246. $one_spread_uid = $orderInfo['spread_uid'];
  247. }
  248. $one_spread_uid = (int)$one_spread_uid;
  249. //冻结时间
  250. $broken_time = intval(sys_config('extract_time'));
  251. $frozen_time = time() + $broken_time * 86400;
  252. //订单中取出
  253. $brokeragePrice = $orderInfo['one_brokerage'] ?? 0;
  254. // 一级返佣金额小于等于0
  255. if ($brokeragePrice <= 0) {//直接二级返佣
  256. return $this->backOrderBrokerageTwo($orderInfo, $userInfo, $isSelfBrokerage, $frozen_time);
  257. }
  258. // 获取上级推广员信息
  259. /** @var UserServices $userServices */
  260. $userServices = app()->make(UserServices::class);
  261. $spreadPrice = $userServices->value(['uid' => $one_spread_uid], 'brokerage_price');
  262. // 上级推广员返佣之后的金额
  263. $balance = bcadd($spreadPrice, $brokeragePrice, 2);
  264. // 添加佣金记录
  265. /** @var UserBrokerageServices $userBrokerageServices */
  266. $userBrokerageServices = app()->make(UserBrokerageServices::class);
  267. //自购返佣 || 上级
  268. $type = $one_spread_uid == $orderInfo['uid'] ? 'get_self_brokerage' : 'get_brokerage';
  269. $res1 = $userBrokerageServices->income($type, $one_spread_uid, [
  270. 'nickname' => $userInfo['nickname'],
  271. 'pay_price' => floatval($orderInfo['pay_price']),
  272. 'number' => floatval($brokeragePrice),
  273. 'frozen_time' => $frozen_time
  274. ], $balance, $orderInfo['id']);
  275. // 添加用户佣金
  276. $res2 = $userServices->bcInc($one_spread_uid, 'brokerage_price', $brokeragePrice, 'uid');
  277. //给上级发送获得佣金的模板消息
  278. $this->sendBackOrderBrokerage($orderInfo, $one_spread_uid, $brokeragePrice);
  279. // 一级返佣成功 跳转二级返佣
  280. $res = $res1 && $res2 && $this->backOrderBrokerageTwo($orderInfo, $userInfo, $isSelfBrokerage, $frozen_time);
  281. return $res;
  282. }
  283. /**
  284. * 二级推广返佣
  285. * @param $orderInfo
  286. * @param $userInfo
  287. * @param int $isSelfbrokerage
  288. * @param int $frozenTime
  289. * @return bool
  290. */
  291. public function backOrderBrokerageTwo($orderInfo, $userInfo, $isSelfbrokerage = 0, $frozenTime = 0)
  292. {
  293. //绑定失效
  294. if (isset($orderInfo['spread_two_uid']) && $orderInfo['spread_two_uid'] == -1) {
  295. return true;
  296. }
  297. /** @var UserServices $userServices */
  298. $userServices = app()->make(UserServices::class);
  299. if (isset($orderInfo['spread_two_uid']) && $orderInfo['spread_two_uid']) {
  300. $spread_two_uid = $orderInfo['spread_two_uid'];
  301. } else {
  302. // 获取上推广人
  303. $userInfoTwo = $userServices->get((int)$userInfo['spread_uid']);
  304. // 订单|上级推广人不存在 直接返回
  305. if (!$orderInfo || !$userInfoTwo) {
  306. return true;
  307. }
  308. //没开启自购返佣 或者 上推广人没有上级 或者 当用用户上上级时自己 直接返回
  309. if (!$isSelfbrokerage && (!$userInfoTwo['spread_uid'] || $userInfoTwo['spread_uid'] == $orderInfo['uid'])) {
  310. return true;
  311. }
  312. $spread_two_uid = $isSelfbrokerage ? $userInfoTwo['uid'] : $userInfoTwo['spread_uid'];
  313. }
  314. $spread_two_uid = (int)$spread_two_uid;
  315. //订单中取出
  316. $brokeragePrice = $orderInfo['two_brokerage'] ?? 0;
  317. // 返佣金额小于等于0 直接返回不返佣金
  318. if ($brokeragePrice <= 0) {
  319. return true;
  320. }
  321. // 获取上上级推广员信息
  322. $spreadPrice = $userServices->value(['uid' => $spread_two_uid], 'brokerage_price');
  323. // 获取上上级推广员返佣之后余额
  324. $balance = bcadd($spreadPrice, $brokeragePrice, 2);
  325. // 添加佣金记录
  326. /** @var UserBrokerageServices $userBrokerageServices */
  327. $userBrokerageServices = app()->make(UserBrokerageServices::class);
  328. $res1 = $userBrokerageServices->income('get_two_brokerage', $spread_two_uid, [
  329. 'nickname' => $userInfo['nickname'],
  330. 'pay_price' => floatval($orderInfo['pay_price']),
  331. 'number' => floatval($brokeragePrice),
  332. 'frozen_time' => $frozenTime
  333. ], $balance, $orderInfo['id']);
  334. // 添加用户佣金
  335. $res2 = $userServices->bcInc($spread_two_uid, 'brokerage_price', $brokeragePrice, 'uid');
  336. //给上级发送获得佣金的模板消息
  337. $this->sendBackOrderBrokerage($orderInfo, $spread_two_uid, $brokeragePrice);
  338. return $res1 && $res2;
  339. }
  340. /**
  341. * 佣金到账发送模板消息
  342. * @param $orderInfo
  343. * @param $spread_uid
  344. * @param $brokeragePrice
  345. */
  346. public function sendBackOrderBrokerage($orderInfo, $spread_uid, $brokeragePrice, string $type = 'order')
  347. {
  348. /** @var UserServices $userServices */
  349. $userServices = app()->make(UserServices::class);
  350. $user = $userServices->getUserInfo($spread_uid, 'phone,user_type');
  351. if ($type == 'order') {
  352. /** @var StoreOrderCartInfoServices $storeOrderCartInfoService */
  353. $storeOrderCartInfoService = app()->make(StoreOrderCartInfoServices::class);
  354. $cartInfo = $storeOrderCartInfoService->getOrderCartInfo($orderInfo['id']);
  355. if ($cartInfo) {
  356. $cartInfo = array_column($cartInfo, 'cart_info');
  357. $goodsPrice = 0;
  358. $goodsName = "";
  359. foreach ($cartInfo as $k => $v) {
  360. $goodsName .= $v['productInfo']['store_name'];
  361. $price = $v['productInfo']['attrInfo']['price'] ?? $v['productInfo']['price'] ?? 0;
  362. $goodsPrice = bcadd((string)$goodsPrice, (string)$price, 2);
  363. }
  364. }
  365. } else {
  366. $goodsName = '推广用户获取佣金';
  367. $goodsPrice = $brokeragePrice;
  368. }
  369. //提醒推送
  370. event('notice.notice', [['spread_uid' => $spread_uid, 'phone' => $user['phone'], 'userType' => $user['user_type'], 'brokeragePrice' => $brokeragePrice, 'goodsName' => $goodsName, 'goodsPrice' => $goodsPrice, 'add_time' => $orderInfo['add_time'] ?? time()], 'order_brokerage']);
  371. return true;
  372. }
  373. /**
  374. * 发送短信
  375. * @param $order
  376. * @param $storeTitle
  377. */
  378. public function smsSend($order, $storeTitle)
  379. {
  380. /** @var SmsSendServices $smsServices */
  381. $smsServices = app()->make(SmsSendServices::class);
  382. $switch = (bool)sys_config('confirm_take_over_switch');
  383. //模板变量
  384. $store_name = $storeTitle;
  385. $order_id = $order['order_id'];
  386. $smsServices->send($switch, $order['user_phone'], compact('store_name', 'order_id'), 'TAKE_DELIVERY_CODE');
  387. }
  388. /**
  389. * 发送确认收货管理员短信
  390. * @param $order
  391. */
  392. public function smsSendTake($order)
  393. {
  394. $switch = (bool)sys_config('admin_confirm_take_over_switch');
  395. /** @var StoreServiceServices $services */
  396. $services = app()->make(StoreServiceServices::class);
  397. $adminList = $services->getStoreServiceOrderNotice();
  398. SmsAdminJob::dispatchDo('sendAdminConfirmTakeOver', [$switch, $adminList, $order]);
  399. return true;
  400. }
  401. /**
  402. * 赠送经验
  403. * @param $order
  404. * @param $userInfo
  405. * @return bool
  406. */
  407. public function gainUserExp($order, $userInfo)
  408. {
  409. if (!$userInfo) {
  410. return true;
  411. }
  412. //用户等级是否开启
  413. if (!sys_config('member_func_status', 1)) {
  414. return true;
  415. }
  416. /** @var UserBillServices $userBillServices */
  417. $userBillServices = app()->make(UserBillServices::class);
  418. $order_exp = 0;
  419. $res3 = true;
  420. $order_give_exp = sys_config('order_give_exp');
  421. $balance = $userInfo['exp'];
  422. if ($order['pay_price'] && $order_give_exp) {
  423. $order_exp = bcmul($order_give_exp, (string)$order['pay_price'], 2);
  424. $balance = bcadd((string)$balance, (string)$order_exp, 2);
  425. $res3 = false != $userBillServices->income('order_give_exp', $order['uid'], $order_exp, $balance, $order['id']);
  426. }
  427. $res = true;
  428. if ($order_exp > 0) {
  429. $userInfo->exp = $balance;
  430. $res1 = false != $userInfo->save();
  431. $res = $res1 && $res3;
  432. }
  433. /** @var UserLevelServices $levelServices */
  434. $levelServices = app()->make(UserLevelServices::class);
  435. $levelServices->detection((int)$order['uid']);
  436. return $res;
  437. }
  438. /**
  439. * 加入队列
  440. * @param array $where
  441. * @param int $count
  442. * @param int $maxLimit
  443. * @return bool
  444. */
  445. public function batchJoinJobs(array $where, int $count, int $maxLimit)
  446. {
  447. $page = ceil($count / $maxLimit);
  448. for ($i = 1; $i <= $page; $i++) {
  449. AutoTakeOrderJob::dispatch([$where, $i, $maxLimit]);
  450. }
  451. return true;
  452. }
  453. /**
  454. * 执行自动收货
  455. * @param array $where
  456. * @param int $page
  457. * @param int $maxLimit
  458. * @return bool
  459. */
  460. public function runAutoTakeOrder(array $where, int $page = 0, int $maxLimit = 0)
  461. {
  462. /** @var StoreOrderStoreOrderStatusServices $service */
  463. $service = app()->make(StoreOrderStoreOrderStatusServices::class);
  464. $orderList = $service->getOrderIds($where, $page, $maxLimit);
  465. /** @var StoreOrderRefundServices $storeOrderRefundServices */
  466. $storeOrderRefundServices = app()->make(StoreOrderRefundServices::class);
  467. foreach ($orderList as $order) {
  468. if ($order['status'] == 2) {
  469. continue;
  470. }
  471. if ($order['paid'] == 1 && $order['status'] == 1) {
  472. $data['status'] = 2;
  473. } else if ($order['pay_type'] == 'offline') {
  474. $data['status'] = 2;
  475. } else {
  476. continue;
  477. }
  478. if ($storeOrderRefundServices->count(['store_order_id' => $order['id'], 'refund_type' => [0, 1, 2, 4, 5], 'is_cancel' => 0, 'is_del' => 1])) {
  479. continue;
  480. }
  481. try {
  482. /** @var StoreOrderStatusServices $statusService */
  483. $statusService = app()->make(StoreOrderStatusServices::class);
  484. $res = $this->dao->update($order['id'], $data) && $statusService->save([
  485. 'oid' => $order['id'],
  486. 'change_type' => 'take_delivery',
  487. 'change_message' => '已收货[自动收货]',
  488. 'change_time' => time()
  489. ]);
  490. $res = $res && $this->storeProductOrderUserTakeDelivery($order);
  491. if (!$res) {
  492. throw new ValidateException('订单号' . $order['order_id'] . '自动收货失败');
  493. }
  494. } catch (\Throwable $e) {
  495. Log::error('自动收货失败,失败原因:' . $e->getMessage());
  496. }
  497. }
  498. return true;
  499. }
  500. /**
  501. * 自动收货
  502. * @return bool
  503. */
  504. public function autoTakeOrder()
  505. {
  506. //7天前时间戳
  507. $systemDeliveryTime = (int)sys_config('system_delivery_time', 0);
  508. //0为取消自动收货功能
  509. if ($systemDeliveryTime == 0) {
  510. return true;
  511. }
  512. $sevenDay = strtotime(date('Y-m-d H:i:s', strtotime('-' . $systemDeliveryTime . ' day')));
  513. /** @var StoreOrderStoreOrderStatusServices $service */
  514. $service = app()->make(StoreOrderStoreOrderStatusServices::class);
  515. $where = [
  516. 'change_time' => $sevenDay,
  517. 'is_del' => 0,
  518. 'paid' => 1,
  519. 'status' => 1,
  520. 'change_type' => ['delivery_goods', 'delivery_fictitious', 'delivery', 'city_delivery']
  521. ];
  522. $maxLimit = 20;
  523. $count = $service->getOrderCount($where);
  524. if ($count > $maxLimit) {
  525. return $this->batchJoinJobs($where, $count, $maxLimit);
  526. }
  527. return $this->runAutoTakeOrder($where);
  528. }
  529. }