ChapterController.php 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182
  1. <?php
  2. namespace App\Http\Controllers\QuickApp\Book;
  3. use App\Modules\SendOrder\Models\SendOrder;
  4. use App\Modules\SendOrder\Services\SendOrderService;
  5. use App\Modules\Statistic\Services\WapVisitStatService;
  6. use App\Modules\User\Services\UserBookCombinationConfigService;
  7. use Illuminate\Http\Request;
  8. use App\Http\Controllers\QuickApp\BaseController;
  9. use Redis;
  10. use App\Modules\Book\Services\ChapterService;
  11. use App\Modules\User\Services\ReadRecordService;
  12. use App\Http\Controllers\QuickApp\Book\Transformers\ChapterTransformer;
  13. use App\Modules\Book\Services\BookConfigService;
  14. use App\Http\Controllers\QuickApp\Book\Transformers\ChapterListTransformer;
  15. use App\Jobs\UserRententionJob;
  16. use App\Modules\Book\Services\BookService;
  17. use App\Modules\Subscribe\Services\BookOrderService;
  18. use App\Modules\Subscribe\Services\ChapterOrderService;
  19. use App\Modules\Subscribe\Services\YearOrderService;
  20. use App\Modules\OfficialAccount\Services\ForceSubscribeService;
  21. use App\Modules\Subscribe\Services\ChapterReminderService;
  22. use App\Modules\User\Services\UserDeepReadTagService;
  23. use App\Modules\UserTask\Services\BaseTask;
  24. use App\Modules\UserTask\Services\UserTaskService;
  25. use App\Modules\SendOrder\Models\QappSendOrder;
  26. class ChapterController extends BaseController
  27. {
  28. private $book_info;
  29. public function getCatalog(Request $request, $bid)
  30. {
  31. $bid = BookService::decodeBidStatic($bid);
  32. $lists = ChapterService::getChapterLists($bid);
  33. $book_info = BookConfigService::getBookById($bid);
  34. if (!$book_info) {
  35. return response()->error('PARAM_ERROR');
  36. }
  37. $this->book_info = $book_info;
  38. $lists = $this->getChapterCatalog($bid, $lists, $book_info);
  39. return response()->collection(new ChapterListTransformer, $lists);
  40. }
  41. public function getCatalogPerPage(Request $request, $bid)
  42. {
  43. $bid = BookService::decodeBidStatic($bid);
  44. $book_info = BookConfigService::getBookById($bid);
  45. if (!$book_info) {
  46. return response()->error('PARAM_ERROR');
  47. }
  48. $this->book_info = $book_info;
  49. $page_size = $request->input('page_size', 15);
  50. // if ($page_size >= 100) $page_size = 100;
  51. if ($page_size >= 20) $page_size = 20;
  52. // $page_size = 15;
  53. $res = ChapterService::getChapterListsPage($bid, $page_size);
  54. $lists = $this->getChapterCatalog($bid, $res, $book_info);
  55. return response()->pagination(new ChapterListTransformer, $lists);
  56. }
  57. private function getChapterCatalog(int $bid, $chapters, $book_info)
  58. {
  59. // 查询书籍是否限免
  60. $isFree = BookConfigService::judgeBookIsFree($bid);
  61. //渠道自定义vip章节
  62. //$vip_sequence = Redis::hget('channel:chapterfee:setting:' . $this->distribution_channel_id, $bid);
  63. $vip_sequence = BookService::getVipSequence($bid, $this->distribution_channel_id, $this->send_order_id);
  64. list($is_split, $is_change_chapter_name) = BookService::splitContent($bid);
  65. $change_chapter_name = 0;
  66. if ($is_split && ($book_info->channel_name == '男频' || $is_change_chapter_name)) {
  67. $change_chapter_name = 1;
  68. }
  69. $account = $this->getAccount();
  70. $work_wechat_info = $this->getWorkWechatInfo($bid);
  71. switch ($book_info->charge_type) {
  72. case 'BOOK':
  73. $price = $this->getPriceNew($book_info, 0, $account);
  74. $is_need_charge = $this->isBookNeedCharge($bid, $price);
  75. foreach ($chapters as $v) {
  76. $v->next_chapter_status = 0;
  77. $v->next_price = 0;
  78. $v->is_need_charge = $v->is_vip ? $is_need_charge : false;
  79. $v->price = $price;
  80. if ($work_wechat_info['force_add_work_wechat_type'] > 0 && $v->sequence >= $work_wechat_info['force_add_work_wechat_seq']){
  81. $v->force_add_work_wechat_type = $work_wechat_info['force_add_work_wechat_type'];
  82. $v->force_add_work_wechat_url = $work_wechat_info['force_add_work_wechat_url'];
  83. }else{
  84. $v->force_add_work_wechat_type = 0;
  85. $v->force_add_work_wechat_url = "";
  86. }
  87. // 限免判断
  88. if ($isFree) {
  89. $v->is_need_charge = false;
  90. $v->price = 0;
  91. }
  92. if ($vip_sequence) {
  93. if ($v->sequence >= $vip_sequence) {
  94. $v->is_vip = 1;
  95. } else {
  96. $v->is_vip = 0;
  97. }
  98. }
  99. //拆章
  100. if ($change_chapter_name) {
  101. $v->name = '第' . $v->sequence . '章';
  102. }
  103. }
  104. break;
  105. default:
  106. $chapterIds = $this->getChapterIds($chapters);
  107. $rules = ['check' => 0, 'paycid' => []];
  108. if (!$isFree && !empty($chapterIds)) {
  109. $rules = $this->getHandelData($bid, $chapterIds);
  110. }
  111. foreach ($chapters as $v) {
  112. if ($vip_sequence) {
  113. if ($v->sequence >= $vip_sequence) {
  114. $v->is_vip = 1;
  115. } else {
  116. $v->is_vip = 0;
  117. }
  118. }
  119. if ($work_wechat_info['force_add_work_wechat_type'] > 0 && $v->sequence >= $work_wechat_info['force_add_work_wechat_seq']){
  120. $v->force_add_work_wechat_type = $work_wechat_info['force_add_work_wechat_type'];
  121. $v->force_add_work_wechat_url = $work_wechat_info['force_add_work_wechat_url'];
  122. }else{
  123. $v->force_add_work_wechat_type = 0;
  124. $v->force_add_work_wechat_url = "";
  125. }
  126. // 限免判断
  127. if ($isFree) {
  128. $v->is_need_charge = false;
  129. $v->price = 0;
  130. } else {
  131. $v->price = $v->is_vip ? $this->getPriceNew($book_info, $v->size, $account) : 0;
  132. $v->is_need_charge = $v->is_vip ? $this->isChapterNeedChargeNew($v->id, $rules, $v->price) : false;
  133. }
  134. // //下一章付费信息
  135. $v->next_chapter_status = 0;
  136. $v->next_price = 0;
  137. // if($v->is_vip){
  138. // if(in_array($v->next_price,$chapterIds)){
  139. //
  140. // }else{
  141. // $next_chapter_order_status = $this->nextChapterOrderStatus($bid,$v->next_cid);
  142. // $v->next_chapter_status = $next_chapter_order_status['next_chapter_status'];
  143. // $v->next_price = $next_chapter_order_status['next_price'];
  144. // }
  145. //
  146. // }
  147. $v->next_chapter_status = $this->isSubscribe($v->id, $rules);
  148. $v->next_price = $v->price;
  149. //拆章
  150. if ($change_chapter_name) {
  151. $v->name = '第' . $v->sequence . '章';
  152. }
  153. }
  154. break;
  155. }
  156. return $chapters;
  157. }
  158. private function getChapterCatalogOld(int $bid, $chapters, $book_info)
  159. {
  160. // 查询书籍是否限免
  161. $isFree = BookConfigService::judgeBookIsFree($bid);
  162. //渠道自定义vip章节
  163. //$vip_sequence = Redis::hget('channel:chapterfee:setting:' . $this->distribution_channel_id, $bid);
  164. $vip_sequence = BookService::getVipSequence($bid, $this->distribution_channel_id, $this->send_order_id);
  165. list($is_split, $is_change_chapter_name) = BookService::splitContent($bid);
  166. $change_chapter_name = 0;
  167. if ($is_split && ($book_info->channel_name == '男频' || $is_change_chapter_name)) {
  168. $change_chapter_name = 1;
  169. }
  170. switch ($book_info->charge_type) {
  171. case 'BOOK':
  172. $price = $this->getPrice($book_info);
  173. $is_need_charge = $this->isBookNeedCharge($bid, $price);
  174. foreach ($chapters as $v) {
  175. $v->next_chapter_status = 0;
  176. $v->next_price = 0;
  177. $v->is_need_charge = $v->is_vip ? $is_need_charge : false;
  178. $v->price = $price;
  179. // 限免判断
  180. if ($isFree) {
  181. $v->is_need_charge = false;
  182. $v->price = 0;
  183. }
  184. if ($vip_sequence) {
  185. if ($v->sequence >= $vip_sequence) {
  186. $v->is_vip = 1;
  187. } else {
  188. $v->is_vip = 0;
  189. }
  190. }
  191. //拆章
  192. if ($change_chapter_name) {
  193. $v->name = '第' . $v->sequence . '章';
  194. }
  195. }
  196. break;
  197. default:
  198. foreach ($chapters as $v) {
  199. if ($vip_sequence) {
  200. if ($v->sequence >= $vip_sequence) {
  201. $v->is_vip = 1;
  202. } else {
  203. $v->is_vip = 0;
  204. }
  205. }
  206. // 限免判断
  207. if ($isFree) {
  208. $v->is_need_charge = false;
  209. $v->price = 0;
  210. } else {
  211. $v->price = $v->is_vip ? $this->getPrice($book_info, $v->size) : 0;
  212. $v->is_need_charge = $v->is_vip ? $this->isChapterNeedCharge($bid, $v->id, $v->price) : false;
  213. }
  214. //下一章付费信息
  215. $v->next_chapter_status = 0;
  216. $v->next_price = 0;
  217. if ($v->is_vip) {
  218. $next_chapter_order_status = $this->nextChapterOrderStatus($bid, $v->next_cid);
  219. $v->next_chapter_status = $next_chapter_order_status['next_chapter_status'];
  220. $v->next_price = $next_chapter_order_status['next_price'];
  221. }
  222. //拆章
  223. if ($change_chapter_name) {
  224. $v->name = '第' . $v->sequence . '章';
  225. }
  226. }
  227. break;
  228. }
  229. return $chapters;
  230. }
  231. public function index(Request $request, $bid, $cid)
  232. {
  233. $send_order_id = $request->header('send_order_id', '');
  234. $package = $request->header('x-package', '');
  235. //每次绑定用户和派单的关系
  236. $this->bindSendOrderId($this->uid, $send_order_id);
  237. $oldbid = $bid;
  238. $bid = BookService::decodeBidStatic($bid);
  239. //获取图书信息
  240. $book_info = BookConfigService::getBookById($bid);
  241. if (empty($book_info))
  242. return response()->error('QAPP_SYS_ERROR');
  243. $this->book_info = $book_info;
  244. $book_auth = BookConfigService::bookCopyright($bid, $this->distribution_channel_id);
  245. if ($book_auth == 2) {
  246. return response()->error('QAPP_OFF_SHELF');
  247. }
  248. //yuyuedu、xinghe 快应用这两个cp的书屏蔽下 wutong,wutong2,wutong3下所有内容都不放快应用
  249. if (in_array($book_info->cp_source, getHiddenCp($package)) && $book_auth != 1) {
  250. return response()->error('QAPP_OFF_SHELF');
  251. }
  252. if ($this->distribution_channel_id == 7477 && $bid == 13765) {
  253. $book_info->is_on_shelf = 2;
  254. }
  255. $special = get_special_bid();
  256. if (in_array($this->distribution_channel_id, [9487, 9390]) && in_array($book_info->bid, $special)) {
  257. $book_info->is_on_shelf = 2;
  258. }
  259. if ($bid == 58886) {
  260. $book_info->is_on_shelf = 0;
  261. }
  262. if (!in_array($book_info->is_on_shelf, [1, 2])) {
  263. if ($book_info->is_on_shelf != 4) {
  264. return response()->error('QAPP_OFF_SHELF');
  265. }
  266. //补充操作:如果该用户未订阅该下架的书籍则删除其阅读记录(书架不予显示)
  267. //判断是否属于包年用户
  268. $year_account = YearOrderService::getRecord($this->uid);
  269. if (!$year_account) {
  270. //获取书籍充值类型
  271. $charge_type = $book_info->charge_type;
  272. if ($charge_type == 'BOOK') {
  273. //是否购买过该书,购买过则不删除
  274. $res = BookOrderService::getRecordByuidBid($this->uid, $bid);
  275. } elseif ($charge_type == 'CHAPTER') {
  276. //是否购买过该书章节,购买过则不删除
  277. $res = ChapterOrderService::checkBookIsOrdered($this->uid, $bid);
  278. } else {
  279. $res = false;
  280. }
  281. if (!$res) {
  282. ReadRecordService::delReadRecordStatic($this->uid, [$bid]);
  283. return response()->error('QAPP_OFF_SHELF');
  284. }
  285. }
  286. }
  287. //wutong,wutong2,wutong3下所有内容都不放快应用
  288. // if(in_array($book_info->cp_source,['wutong','wutong2','wutong3','youyan2'])){
  289. // return response()->error('QAPP_OFF_SHELF');
  290. // }
  291. $this->book_info = $book_info;
  292. //获取章节信息
  293. $chapter = ChapterService::getChapterNameById($cid, $bid);
  294. if (!$chapter) {
  295. //短推长
  296. $combination_chapter = $this->chapterNotExists($bid, $cid);
  297. if ($combination_chapter) {
  298. $chapter = $combination_chapter;
  299. $bid = $chapter->bid;
  300. $book_info = BookConfigService::getBookById($bid);
  301. $oldbid = \Hashids::encode($bid);
  302. $this->book_info = $book_info;
  303. } else {
  304. return response()->error('QAPP_SYS_ERROR');
  305. }
  306. }
  307. list($is_split, $is_change_chapter_name) = BookService::splitContent($bid);
  308. if ($is_split && ($book_info->channel_name == '男频' || $is_change_chapter_name)) {
  309. $chapter->name = '第' . $chapter->sequence . '章';
  310. }
  311. $is_next_day = date('Y-m-d', strtotime($this->user_info->created_at)) == date('Y-m-d', strtotime('-1 days'));
  312. if ($is_next_day) {
  313. $job = new UserRententionJob($this->uid, now(), $this->user_info->created_at);
  314. dispatch($job)->onConnection('rabbitmq')->onQueue('user_rentention_queue');
  315. }
  316. //自定义vip章节
  317. //$vip_sequence = Redis::hget('channel:chapterfee:setting:' . $this->distribution_channel_id, $bid);
  318. $vip_sequence = BookService::getVipSequence($bid, $this->distribution_channel_id, $this->send_order_id);
  319. if ($vip_sequence) {
  320. if ($chapter->sequence >= $vip_sequence) {
  321. $chapter->is_vip = 1;
  322. } else {
  323. $chapter->is_vip = 0;
  324. }
  325. }
  326. if ($chapter->is_vip == 0) {
  327. ReadRecordService::addReadLog($this->uid, [
  328. 'distribution_channel_id' => $this->distribution_channel_id,
  329. 'bid' => $bid,
  330. 'cid' => $chapter->id,
  331. 'uid' => $this->uid,
  332. 'send_order_id' => $this->send_order_id,
  333. 'sequence' => $chapter->sequence,
  334. ]);
  335. ReadRecordService::addReadRecord([
  336. 'uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
  337. 'cid' => $cid, 'chapter_name' => $chapter->name, 'sequence' => $chapter->sequence
  338. ]);
  339. return response()->item(new ChapterTransformer, $this->getChapter($bid, $chapter->id, $chapter));
  340. }
  341. // 书籍是否限免
  342. $free = BookConfigService::judgeBookIsFree($bid);
  343. if ($free) {
  344. ReadRecordService::addReadLog($this->uid, [
  345. 'distribution_channel_id' => $this->distribution_channel_id,
  346. 'bid' => $bid,
  347. 'cid' => $chapter->id,
  348. 'uid' => $this->uid,
  349. 'send_order_id' => $this->send_order_id,
  350. 'sequence' => $chapter->sequence,
  351. ]);
  352. ReadRecordService::addReadRecord([
  353. 'uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
  354. 'cid' => $cid, 'chapter_name' => $chapter->name, 'sequence' => $chapter->sequence
  355. ]);
  356. if ($chapter->is_vip == 1) {
  357. $fee = $this->getPrice($book_info, $chapter->size);
  358. $now = date('Y-m-d');
  359. Redis::hincrby('qapp:book:free:virtual:' . $free->id, $now, $fee);
  360. Redis::sadd('qapp:free:virtual' . $now, $free->id);
  361. Redis::sadd('qapp:free:virtual:uids' . $now . $free->id, $this->uid);
  362. Redis::sadd('qapp:free:virtual:uids' . $free->id, $this->uid);
  363. }
  364. return response()->item(new ChapterTransformer, $this->getChapter($bid, $cid, $chapter));
  365. }
  366. //已经付费
  367. if ($this->getOrderRecord($bid, $cid)) {
  368. ReadRecordService::addReadLog($this->uid, [
  369. 'distribution_channel_id' => $this->distribution_channel_id,
  370. 'bid' => $bid,
  371. 'cid' => $chapter->id,
  372. 'uid' => $this->uid,
  373. 'send_order_id' => $this->send_order_id,
  374. 'sequence' => $chapter->sequence,
  375. ]);
  376. ReadRecordService::addReadRecord([
  377. 'uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
  378. 'cid' => $cid, 'chapter_name' => $chapter->name, 'sequence' => $chapter->sequence
  379. ]);
  380. return response()->item(new ChapterTransformer, $this->getChapter($bid, $cid, $chapter));
  381. }
  382. //未付费 要提醒
  383. $user_info = $this->user_info;
  384. //未付费 余额不足
  385. $fee = $this->getPrice($book_info, $chapter->size);
  386. $data = [
  387. 'book_id' => $oldbid,
  388. 'book_name' => $book_info->book_name,
  389. 'chapter_name' => $chapter->name,
  390. 'chapter_id' => $cid,
  391. 'pay_type' => $book_info->charge_type,
  392. 'fee' => $fee,
  393. 'user_balance' => $user_info->balance,
  394. 'product_id' => $book_info->product_id,
  395. 'uid' => $this->uid,
  396. 'distribution_channel_id' => $this->distribution_channel_id,
  397. 'is_discount' => 0,
  398. 'discount_fee' => '',
  399. 'discount' => ''
  400. ];
  401. if ($user_info['balance'] < $fee) {
  402. if ($book_info->charge_type == 'BOOK') {
  403. return response()->error('QAPP_BOOK_INSUFFICIENT_BALANCE', $data);
  404. } elseif ($book_info->charge_type == 'CHAPTER') {
  405. return response()->error('QAPP_CHAPTER_INSUFFICIENT_BALANCE', $data);
  406. } else {
  407. return response()->error('QAPP_SYS_ERROR');
  408. }
  409. }
  410. if (!$this->send_order_id) {
  411. if ($book_info->charge_type == 'BOOK') {
  412. return response()->error('QAPP_BOOK_BUY', $data);
  413. }/*else{
  414. return response()->error('QAPP_CHAPTER_BUY', $data);
  415. }*/
  416. }
  417. //付费 不提醒
  418. if ($this->balancePay($book_info, $cid, $chapter->size, $chapter->name, 0)) {
  419. UserTaskService::addUserTaskQueue($this->uid, BaseTask::read, UserTaskService::judge_trigger);
  420. ReadRecordService::addReadLog($this->uid, [
  421. 'distribution_channel_id' => $this->distribution_channel_id,
  422. 'bid' => $bid,
  423. 'cid' => $chapter->id,
  424. 'uid' => $this->uid,
  425. 'send_order_id' => $this->send_order_id,
  426. 'sequence' => $chapter->sequence,
  427. ]);
  428. ReadRecordService::addReadRecord([
  429. 'uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
  430. 'cid' => $cid, 'chapter_name' => $chapter->name, 'sequence' => $chapter->sequence
  431. ]);
  432. //限免统计
  433. $free_book = BookConfigService::getByBidNoFilter($bid);
  434. if ($free_book) {
  435. if (strtotime($free_book->end_time) + 7 * 86400 >= strtotime(date('Y-m-d'))) {
  436. if (Redis::Sismember('qapp:free:virtual:uids' . $free_book->id, $this->uid)) {
  437. $now = date('Y-m-d');
  438. Redis::hincrby('qapp:book:free:actuality:' . $free_book->id, $now, $fee);
  439. Redis::sadd('qapp:free:actuality' . $now, $free_book->id);
  440. Redis::sadd('qapp:free:actuality:uids' . $now . $free_book->id, $this->uid);
  441. }
  442. }
  443. }
  444. if ($this->uid == 247081369) {
  445. $item = itemTransform(new ChapterTransformer, $this->getChapter($bid, $cid, $chapter));
  446. myLog('xueqi')->info($item);
  447. }
  448. return response()->item(new ChapterTransformer, $this->getChapter($bid, $cid, $chapter));
  449. } else {
  450. if ($book_info->charge_type == 'BOOK') {
  451. return response()->error('QAPP_BOOK_INSUFFICIENT_BALANCE', $data);
  452. } elseif ($book_info->charge_type == 'CHAPTER') {
  453. return response()->error('QAPP_CHAPTER_INSUFFICIENT_BALANCE', $data);
  454. } else {
  455. return response()->error('QAPP_SYS_ERROR');
  456. }
  457. }
  458. }
  459. public function pay(Request $request, $bid, $cid)
  460. {
  461. $remind = (int)$request->input('remind');
  462. $oldbid = $bid;
  463. $bid = BookService::decodeBidStatic($bid);
  464. $book_info = BookConfigService::getBookById($bid);;
  465. if (empty($book_info)) response()->error('QAPP_SYS_ERROR');
  466. $this->book_info = $book_info;
  467. if ($this->distribution_channel_id == 7477 && $bid == 13765) {
  468. $book_info->is_on_shelf = 2;
  469. }
  470. if ($book_info->is_on_shelf == 0 || $book_info->is_on_shelf == 3) {
  471. if (!$this->isBookOrdered($bid)) {
  472. response()->error('QAPP_OFF_SHELF');
  473. }
  474. }
  475. //获取章节
  476. $chapter = ChapterService::getChapterNameById($cid, $bid);
  477. if (!$chapter) {
  478. $combination_chapter = $this->chapterNotExists($bid, $cid);
  479. if ($combination_chapter) {
  480. $chapter = $combination_chapter;
  481. $bid = $chapter->bid;
  482. $book_info = BookConfigService::getBookById($bid);
  483. $oldbid = \Hashids::encode($bid);
  484. $this->book_info = $book_info;
  485. } else {
  486. return response()->error('QAPP_SYS_ERROR');
  487. }
  488. }
  489. if ($this->getOrderRecord($bid, $cid)) {
  490. ReadRecordService::addReadLog($this->uid, [
  491. 'distribution_channel_id' => $this->distribution_channel_id,
  492. 'bid' => $bid,
  493. 'cid' => $chapter->id,
  494. 'uid' => $this->uid,
  495. 'send_order_id' => $this->send_order_id,
  496. 'sequence' => $chapter->sequence,
  497. ]);
  498. ReadRecordService::addReadRecord([
  499. 'uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
  500. 'cid' => $cid, 'chapter_name' => $chapter->name, 'sequence' => $chapter->sequence
  501. ]);
  502. return response()->item(new ChapterTransformer, $this->getChapter($bid, $cid, $chapter));
  503. }
  504. if ($this->balancePay($book_info, $cid, $chapter->size, $chapter->name, $remind)) {
  505. UserTaskService::addUserTaskQueue($this->uid, BaseTask::read, UserTaskService::judge_trigger);
  506. ReadRecordService::addReadLog($this->uid, [
  507. 'distribution_channel_id' => $this->distribution_channel_id,
  508. 'bid' => $bid,
  509. 'cid' => $chapter->id,
  510. 'uid' => $this->uid,
  511. 'send_order_id' => $this->send_order_id,
  512. 'sequence' => $chapter->sequence,
  513. ]);
  514. ReadRecordService::addReadRecord([
  515. 'uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
  516. 'cid' => $cid, 'chapter_name' => $chapter->name, 'sequence' => $chapter->sequence
  517. ]);
  518. $free_book = BookConfigService::getByBidNoFilter($bid);
  519. if ($free_book) {
  520. if (strtotime($free_book->end_time) + 7 * 86400 >= strtotime(date('Y-m-d'))) {
  521. if (Redis::Sismember('qapp:free:virtual:uids' . $free_book->id, $this->uid)) {
  522. $now = date('Y-m-d');
  523. $fee = $this->getPrice($book_info, $chapter->size);
  524. Redis::hincrby('qapp:book:free:actuality:' . $free_book->id, $now, $fee);
  525. Redis::sadd('qapp:free:actuality' . $now, $free_book->id);
  526. Redis::sadd('qapp:free:actuality:uids' . $now . $free_book->id, $this->uid);
  527. }
  528. }
  529. }
  530. return response()->item(new ChapterTransformer, $this->getChapter($bid, $cid, $chapter));
  531. } else {
  532. $fee = $this->getPrice($book_info, $chapter->size);
  533. $data = [
  534. 'book_id' => $oldbid,
  535. 'book_name' => $book_info->book_name,
  536. 'chapter_name' => $chapter->name,
  537. 'chapter_id' => $cid,
  538. 'pay_type' => $book_info->charge_type,
  539. 'fee' => $fee,
  540. 'user_balance' => $this->user_info['balance'],
  541. 'product_id' => $book_info->product_id,
  542. 'uid' => $this->uid,
  543. 'distribution_channel_id' => $this->distribution_channel_id,
  544. 'is_discount' => 0,
  545. 'discount_fee' => '',
  546. 'discount' => ''
  547. ];
  548. if ($book_info->charge_type == 'BOOK') {
  549. return response()->error('QAPP_BOOK_INSUFFICIENT_BALANCE', $data);
  550. } elseif ($book_info->charge_type == 'CHAPTER') {
  551. return response()->error('QAPP_CHAPTER_INSUFFICIENT_BALANCE', $data);
  552. } else {
  553. return response()->error('QAPP_SYS_ERROR');
  554. }
  555. }
  556. }
  557. /**
  558. * 余额支付
  559. * @param $book_info
  560. * @param $chapter_id
  561. * @param $chapter_size
  562. * @return bool
  563. */
  564. protected function balancePay($book_info, $chapter_id, $chapter_size, $chapter_name, $is_remind)
  565. {
  566. $fee = $this->getPrice($book_info, $chapter_size);
  567. if ((int)$this->user_info['balance'] >= $fee) {
  568. if ($this->bookOrderOrChapterOrder($book_info, $chapter_id, $fee, $chapter_name, $is_remind)) {
  569. return true;
  570. }
  571. return false;
  572. } else {
  573. return false;
  574. }
  575. }
  576. /**
  577. * 获取章节内容
  578. * @param $bid
  579. * @param $cid
  580. * @return bool|mixed
  581. */
  582. protected function getChapter($bid, $cid, $chapter)
  583. {
  584. $chapter_content = ChapterService::getChapter($bid, $cid);
  585. if (!$chapter_content) return false;
  586. $chapter->content = trim(str_replace($chapter_content->name, '', $chapter_content->content));
  587. // 格式特殊处理
  588. $qian = array(" ", " ", "\t");
  589. $hou = array("", "", "");
  590. // 去掉所有空格
  591. $chapter->content = str_replace($qian, $hou, $chapter->content);
  592. // 2换行变1换行
  593. $chapter->content = str_replace("\n\n", "\n", $chapter->content);
  594. $chapter->content = str_replace("\r\n\r\n", "\r\n", $chapter->content);
  595. // \Log::info('getChapter_chapter:'.$bid.' cid:'.$cid);
  596. // \Log::info($chapter->content);
  597. //统计点击率
  598. $key = 'book_click_num_bid_' . $bid;
  599. $field = date('Y-m-d');
  600. $old = Redis::hget($key, $field);
  601. if (!$old) $old = 0;
  602. Redis::hset($key, $field, $old + 1);
  603. [$force_add_desk_type,$is_need_query_send_order] = $this->addDesktopType($bid, $chapter->sequence);
  604. $chapter->force_add_desk_type = $force_add_desk_type;
  605. $force_add_work_wechat_type = 0;
  606. $force_add_work_wechat_url = "";
  607. if($is_need_query_send_order){
  608. [$force_add_work_wechat_type, $force_add_work_wechat_url] = $this->addWorkWechatType($chapter->sequence);
  609. }
  610. $chapter->force_add_work_wechat_type = $force_add_work_wechat_type;
  611. $chapter->force_add_work_wechat_url = $force_add_work_wechat_url;
  612. //统计
  613. $this->stats();
  614. $next_chapter_order_status = $this->nextChapterOrderStatus($bid, $chapter->next_cid);
  615. $chapter->next_chapter_status = $next_chapter_order_status['next_chapter_status'];
  616. $chapter->next_price = $next_chapter_order_status['next_price'];
  617. $chapter->charge_type = $this->book_info->charge_type;
  618. $this->userBookCombination($chapter);
  619. return $chapter;
  620. }
  621. private function nextChapterOrderStatus($bid, $cid)
  622. {
  623. $chapter = ChapterService::getChapterNameById($cid, $bid);
  624. if (!$chapter || $chapter->is_vip == 0 || $this->book_info->charge_type == 'BOOK') {
  625. return ['next_chapter_status' => 0, 'next_price' => 0];
  626. }
  627. $is_paid = $this->getOrderRecord($bid, $cid);
  628. if ($is_paid) {
  629. return ['next_chapter_status' => 1, 'next_price' => 0];
  630. }
  631. $fee = $this->getPrice($this->book_info, $chapter->size);
  632. return ['next_chapter_status' => 2, 'next_price' => $fee];
  633. }
  634. //短续长
  635. private function userBookCombination($chapter)
  636. {
  637. if ($chapter->prev_cid && $chapter->next_cid) {
  638. return;
  639. }
  640. if ($chapter->next_cid == 0 && $this->book_info->charge_type == 'BOOK') {
  641. $bid = UserBookCombinationConfigService::selectAndSave($this->uid, $this->book_info->bid);
  642. if ($bid) {
  643. $bookInfo = BookConfigService::getBookById($bid);
  644. $chapter->next_cid = $bookInfo->first_cid;
  645. }
  646. }
  647. if ($chapter->prev_cid == 0 && $this->book_info->charge_type == 'CHAPTER') {
  648. $bid = UserBookCombinationConfigService::getShortBookFromLongBid($this->uid, $this->book_info->bid);
  649. if ($bid) {
  650. $bookInfo = BookConfigService::getBookById($bid);
  651. $chapter->prev_cid = $bookInfo->last_cid;
  652. }
  653. }
  654. }
  655. private function chapterNotExists($bid, $cid)
  656. {
  657. //1.全局图书组合配置
  658. $combination = BookConfigService::getCombinationInfo($bid);
  659. if ($combination) {
  660. $chapter = ChapterService::getChapterNameByIdNoCheck($cid);
  661. if ($chapter) {
  662. return $chapter;
  663. }
  664. return false;
  665. }
  666. //2.用户图书组合配置
  667. if ($this->book_info->charge_type == 'CHAPTER') {
  668. $user_combination = UserBookCombinationConfigService::getShortBookFromLongBook($this->uid, $bid);
  669. } else {
  670. $user_combination = UserBookCombinationConfigService::getLongBookFromShortBook($this->uid, $bid);
  671. }
  672. if ($user_combination) {
  673. $chapter = ChapterService::getChapterNameByIdNoCheck($cid);
  674. if ($chapter) {
  675. return $chapter;
  676. }
  677. return false;
  678. }
  679. return false;
  680. }
  681. /**
  682. * 添加订购记录
  683. * @param $book_info
  684. * @param $chapter_id
  685. * @param $fee
  686. * @return bool
  687. */
  688. protected function bookOrderOrChapterOrder($book_info, $chapter_id, $fee, $chapter_name, $is_remind)
  689. {
  690. if ($book_info['charge_type'] == 'BOOK') {
  691. $data = [
  692. 'uid' => $this->uid,
  693. 'fee' => $fee,
  694. 'u' => $this->send_order_id,
  695. 'distribution_channel_id' => $this->distribution_channel_id,
  696. 'bid' => $book_info->bid,
  697. 'book_name' => $book_info->book_name,
  698. 'send_order_id' => $this->send_order_id,
  699. ];
  700. return BookOrderService::addOrderRecodeAndDecrUserBalance($data, $this->uid);
  701. } else {
  702. $data = [
  703. 'uid' => $this->uid,
  704. 'fee' => $fee,
  705. 'cid' => $chapter_id,
  706. 'bid' => $book_info->bid,
  707. 'distribution_channel_id' => $this->distribution_channel_id,
  708. 'book_name' => $book_info->book_name,
  709. 'chapter_name' => $chapter_name,
  710. 'send_order_id' => $this->send_order_id,
  711. 'is_remind' => $is_remind
  712. ];
  713. if ($is_remind) {
  714. $this->addOrderRemind($book_info->bid);
  715. }
  716. return ChapterOrderService::addOrderAndDecrUserBalance($data, $this->uid);
  717. }
  718. }
  719. protected function addOrderRemind($bid)
  720. {
  721. if (ChapterReminderService::checkIsNoReminder($this->uid, $bid)) {
  722. return true;
  723. } else {
  724. ChapterReminderService::add($this->uid, $bid);
  725. return true;
  726. }
  727. }
  728. /**
  729. * 是否订购提醒
  730. * @param $chapter_id
  731. * @return bool
  732. */
  733. protected function isOrderRemind($bid)
  734. {
  735. $is_no_reminder = ChapterReminderService::checkIsNoReminder($this->uid, $bid) ? 1 : 0;
  736. return $is_no_reminder == 0;
  737. }
  738. /**
  739. * 用户是否关注
  740. * @param $uid
  741. * @return bool
  742. */
  743. protected function getSubscribe()
  744. {
  745. $res = ForceSubscribeService::forceSubscribeUsersByUid(['uid' => $this->uid]);
  746. if ($res) return true;
  747. return false;
  748. }
  749. /**
  750. * 获取订购记录
  751. * @param $book_info
  752. * @param $chapter_id
  753. * @return bool
  754. */
  755. protected function getOrderRecord($bid, $chapter_id)
  756. {
  757. //包年记录
  758. $uid = $this->uid;
  759. $res = YearOrderService::getRecord($uid);
  760. if ($res) return true;
  761. $res = null;
  762. //单本订购记录
  763. $res = BookOrderService::getRecordByuidBid($uid, $bid);
  764. if ($res) return true;
  765. $res = null;
  766. //章节订购记录
  767. $chapterOrder = new ChapterOrderService();
  768. if ($chapterOrder->checkIsOrdered($uid, $bid, $chapter_id)) return true;
  769. return false;
  770. }
  771. /**
  772. * 计算价格
  773. * @param $book_info
  774. * @param $chapter_size
  775. * @return float
  776. */
  777. private function getPrice($book_info, $chapter_size = 0)
  778. {
  779. if ($book_info->charge_type == 'BOOK') {
  780. if (BookOrderService::isHasBookOrder($this->uid)) {
  781. $this->is_first_book_order = 0;
  782. return 1399;
  783. } else {
  784. $this->is_first_book_order = 1;
  785. return 899;
  786. }
  787. } else {
  788. // 获取投放后台账号,
  789. $account = '';
  790. $account_send_order = $this->getNowSendOrderInfo();
  791. if ($account_send_order) {
  792. $account = isset($account_send_order['account']) ? $account_send_order['account'] : '';
  793. }
  794. $fee = BookService::getPrice($book_info, $this->distribution_channel_id, $chapter_size, $account);
  795. return $fee;
  796. }
  797. }
  798. /**
  799. * 计算价格
  800. * @param $book_info
  801. * @param $chapter_size
  802. * @return float
  803. */
  804. private function getPriceNew($book_info, $chapter_size = 0, $account = "")
  805. {
  806. if ($book_info->charge_type == 'BOOK') {
  807. if (BookOrderService::isHasBookOrder($this->uid)) {
  808. $this->is_first_book_order = 0;
  809. return 1399;
  810. } else {
  811. $this->is_first_book_order = 1;
  812. return 899;
  813. }
  814. } else {
  815. return BookService::getPrice($book_info, $this->distribution_channel_id, $chapter_size, $account);
  816. }
  817. }
  818. /**
  819. * 获取投放后台账号,
  820. * name: getAccount
  821. * @return mixed|string
  822. * date 2022/10/20 11:29
  823. */
  824. protected function getAccount()
  825. {
  826. $account = '';
  827. $account_send_order = $this->getNowSendOrderInfo();
  828. if ($account_send_order) {
  829. $account = isset($account_send_order['account']) ? $account_send_order['account'] : '';
  830. }
  831. return $account;
  832. }
  833. /**
  834. * 用户添加标签
  835. * @param $book_info
  836. */
  837. protected function addTag($book_info)
  838. {
  839. if (!UserDeepReadTagService::isAddTag($this->uid, $book_info->bid)) {
  840. try {
  841. UserDeepReadTagService::addTag([
  842. 'uid' => $this->uid,
  843. 'bid' => $book_info->bid,
  844. 'book_name' => $book_info->book_name,
  845. 'category_id' => $book_info->category_id,
  846. 'category_name' => $book_info->category_name,
  847. 'sex_preference' => $book_info->channel_name ? $book_info->channel_name : '',
  848. 'distribution_channel_id' => $this->distribution_channel_id ? $this->distribution_channel_id : '0',
  849. 'send_order_id' => $this->send_order_id,
  850. ]);
  851. } catch (\Exception $e) {
  852. }
  853. }
  854. }
  855. protected function isBookOrdered($bid)
  856. {
  857. $chapter_order = ChapterOrderService::checkBookIsOrdered($this->uid, $bid);
  858. if ($chapter_order) return true;
  859. $res = BookOrderService::getRecordByuidBid($this->uid, $bid);
  860. if ($res) return true;
  861. return false;
  862. }
  863. /**
  864. * 判断是否需要充值
  865. */
  866. private function isBookNeedCharge(int $bid, float $price)
  867. {
  868. $book_order = $this->getOrderRecord($bid, 0);
  869. if ($book_order) {
  870. return false;
  871. } else {
  872. $user_info = $this->user_info;
  873. return $user_info['balance'] < $price;
  874. }
  875. }
  876. /**
  877. * 判断章节是否需要充值
  878. */
  879. private function isChapterNeedCharge(int $bid, int $cid, float $price)
  880. {
  881. $book_order = $this->getOrderRecord($bid, $cid);
  882. if ($book_order) {
  883. return false;
  884. } else {
  885. $user_info = $this->user_info;
  886. return $user_info['balance'] < $price;
  887. }
  888. }
  889. private function stats()
  890. {
  891. //阅读器统计
  892. WapVisitStatService::recordReaderUvAndPv($this->uid, $this->distribution_channel_id);
  893. }
  894. //加桌类型
  895. private function addDesktopType($bid, $sequence)
  896. {
  897. $deault_force_add_desk_type = 0;
  898. $send_order_id = $this->GetBindSendOrderId($this->uid);
  899. $is_need_query_order = 0;
  900. if ($send_order_id) {
  901. $send_order_info = SendOrderService::getById($send_order_id);
  902. if (!$send_order_info) return [$deault_force_add_desk_type,$is_need_query_order];
  903. if ($send_order_info->book_id == $bid) {
  904. $is_need_query_order = 1;
  905. // 派单书籍和观看书籍一致,并设置了强加桌,判断当前章节和设置的强加桌章节
  906. if ($send_order_info->force_add_desk_type == 1 && $send_order_info->force_add_desk_seq) {
  907. //在设置的强加桌章节前一章开始
  908. if ($sequence >= ($send_order_info->force_add_desk_seq - 1)) {
  909. $force_add_desk_type = $send_order_info->force_add_desk_type;
  910. return [$force_add_desk_type,$is_need_query_order];
  911. }
  912. }
  913. if ($send_order_info->force_add_desk_type == 2) {
  914. if ($sequence >= $this->book_info->force_subscribe_chapter_seq && $sequence <= $this->book_info->force_subscribe_chapter_seq + 3) {
  915. $force_add_desk_type = $send_order_info->force_add_desk_type;
  916. return [$force_add_desk_type,$is_need_query_order];
  917. }
  918. }
  919. if ($send_order_info->force_add_desk_type == 3) {
  920. //弱加桌+强加桌 ,即强加桌章节之前的章节均弱加桌,之后的章节显示强加桌:
  921. $need_sequence = $send_order_info->force_add_desk_seq;
  922. if (!$need_sequence) {
  923. $need_sequence = $this->book_info->force_subscribe_chapter_seq;
  924. }
  925. if ($sequence >= ($need_sequence - 1)) {
  926. //之后的章节显示强加桌
  927. return [1,$is_need_query_order];
  928. } else {
  929. ////强加桌章节之前的章节均弱加桌
  930. return [2,$is_need_query_order];
  931. }
  932. }
  933. return [$deault_force_add_desk_type,$is_need_query_order];
  934. }
  935. }
  936. //无派单,或者派单书籍与 此次书籍不一致,直接使用 原书籍的默认强关章节
  937. $book_info = BookConfigService::getBookById($bid);
  938. if ($book_info && $book_info->force_subscribe_chapter_seq) {
  939. if ($sequence >= ($book_info->force_subscribe_chapter_seq - 1)) {
  940. return [2,$is_need_query_order];
  941. }
  942. }
  943. return [$deault_force_add_desk_type,$is_need_query_order];
  944. }
  945. private function addWorkWechatType($sequence)
  946. {
  947. $deault_force_add_desk_type = 0;
  948. $work_wechat_url = "";
  949. $send_order_id = $this->GetBindSendOrderId($this->uid);
  950. if ($send_order_id) {
  951. $send_order_info = QappSendOrder::getSendOrderById($send_order_id);
  952. if (!$send_order_info) return [$deault_force_add_desk_type, $work_wechat_url];
  953. if($send_order_info['force_add_work_wechat_status'] == 1 && $send_order_info['force_add_work_wechat_seq'] <= ($sequence+1)){
  954. $deault_force_add_desk_type =$send_order_info['force_add_work_wechat_type'];
  955. $work_wechat_url =$send_order_info['force_add_work_wechat_url'];
  956. }
  957. }
  958. return [$deault_force_add_desk_type, $work_wechat_url];
  959. }
  960. /**
  961. * [bindSendOrderId description]
  962. * @param [type] $uid [description]
  963. * @param [type] $send_order_id [description]
  964. * @return [type] [description]
  965. */
  966. public function bindSendOrderId($uid, $send_order_id)
  967. {
  968. if ($send_order_id) {
  969. $res = Redis::hset('book_read_chapter:' . $uid, 'send_order_id', $send_order_id);
  970. }
  971. }
  972. /**
  973. * [bindSendOrderId description]
  974. * @param [type] $uid [description]
  975. * @param [type] $send_order_id [description]
  976. * @return [type] [description]
  977. */
  978. public function GetBindSendOrderId($uid)
  979. {
  980. try {
  981. $send_order_id = Redis::hget('book_read_chapter:' . $uid, 'send_order_id');
  982. if ($send_order_id)
  983. return (int)$send_order_id;
  984. } catch (\Exception $e) {
  985. }
  986. }
  987. private function getChapterIds($chapters): array
  988. {
  989. $list = [];
  990. if ($chapters) {
  991. foreach ($chapters as $v) {
  992. $list[] = $v->id;
  993. }
  994. }
  995. return $list;
  996. }
  997. private function getHandelData(int $bid, array $chapterIds): array
  998. {
  999. $uid = $this->uid;
  1000. $res = YearOrderService::getRecord($uid);
  1001. if ($res) {
  1002. return $handle = ['check' => 0, 'paycid' => []];
  1003. }
  1004. $res = null;
  1005. //单本订购记录
  1006. $res = BookOrderService::getRecordByuidBid($uid, $bid);
  1007. if ($res) {
  1008. return $handle = ['check' => 0, 'paycid' => []];
  1009. }
  1010. //章节订购记录
  1011. $chapterOrder = new ChapterOrderService();
  1012. $res = $chapterOrder->getOrdersByChapterIds($uid, $bid, $chapterIds);
  1013. return $handle = ['check' => 1, 'paycid' => $res];
  1014. }
  1015. /**
  1016. * 判断是否需要充值
  1017. * name: isChapterNeedChargeNew
  1018. * @param $cid
  1019. * @param $rules
  1020. * @return bool
  1021. * date 2022/10/20 16:08
  1022. */
  1023. private function isChapterNeedChargeNew($cid, $rules, $price = 0): bool
  1024. {
  1025. if ($rules['check'] != 1) {
  1026. return false;
  1027. }
  1028. if (empty($rules['paycid']) || !in_array($cid, $rules['paycid'])) {
  1029. $user_info = $this->user_info;
  1030. return $user_info['balance'] < $price;
  1031. } else {
  1032. return false;
  1033. }
  1034. }
  1035. /*****
  1036. * 是否订阅
  1037. * name: isSubscribe
  1038. * @param $cid
  1039. * @param $rules
  1040. * @return int
  1041. * date 2022/11/02 17:19
  1042. */
  1043. private function isSubscribe($cid, $rules): int
  1044. {
  1045. if ($rules['check'] != 1) {
  1046. return 1;
  1047. }
  1048. if (empty($rules['paycid']) || !in_array($cid, $rules['paycid'])) {
  1049. return 2;
  1050. } else {
  1051. return 1;
  1052. }
  1053. }
  1054. private function getWorkWechatInfo($bid)
  1055. {
  1056. $info = ['force_add_work_wechat_type' => 0,'force_add_work_wechat_url' => "",'force_add_work_wechat_seq' => 0];
  1057. $send_order_id = $this->GetBindSendOrderId($this->uid);
  1058. if ($send_order_id) {
  1059. $send_order_info = QappSendOrder::getSendOrderById($send_order_id);
  1060. if (!$send_order_info) return $info;
  1061. $send_order_bid = SendOrder::where(['id' => $send_order_id])->value('book_id');
  1062. if($send_order_info['force_add_work_wechat_status'] == 1 && $send_order_bid == $bid){
  1063. $info['force_add_work_wechat_type'] = $send_order_info['force_add_work_wechat_type'];
  1064. $info['force_add_work_wechat_url'] = $send_order_info['force_add_work_wechat_url'];
  1065. $info['force_add_work_wechat_seq'] = $send_order_info['force_add_work_wechat_seq'];
  1066. }else{
  1067. return $info;
  1068. }
  1069. }
  1070. return $info;
  1071. }
  1072. }