ChapterController.php 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140
  1. <?php
  2. namespace App\Http\Controllers\Wap\Book;
  3. use App\Modules\Book\Models\DataAnalysisBookConfig;
  4. use App\Modules\Book\Services\BookService;
  5. use App\Modules\Book\Services\ChapterCommentsService;
  6. use App\Modules\Book\Services\ChapterShareWechatConfigService;
  7. use App\Modules\Statistic\Models\DataAnalysisSelectUser;
  8. use App\Modules\Statistic\Services\AdVisitStatService;
  9. use App\Modules\Statistic\Services\DataAnalysisChapterService;
  10. use App\Modules\Statistic\Services\DataAnalysisSelectUserService;
  11. use App\Modules\Statistic\Services\WapVisitStatService;
  12. use App\Modules\Subscribe\Services\CrmChapterOrderDetailService;
  13. use App\Modules\Subscribe\Services\CustomChapterOrderService;
  14. use App\Modules\Subscribe\Services\OrderService;
  15. use App\Modules\Subscribe\Models\Order;
  16. use App\Modules\User\Services\CrmUserService;
  17. use App\Modules\User\Services\ForceGuidePersonAccountService;
  18. use App\Modules\User\Services\ForceSubscribeUserIService;
  19. use App\Modules\User\Services\ReadRecordStatsService;
  20. use App\Modules\User\Services\UserBindHkWelfareService;
  21. use App\Modules\User\Services\UserService;
  22. use App\Modules\YunQi\Services\BookUserService;
  23. use Illuminate\Http\Request;
  24. use App\Http\Controllers\Wap\BaseController;
  25. use Cookie;
  26. use Redis;
  27. use App\Modules\Book\Services\ChapterService;
  28. use App\Modules\User\Services\ReadRecordService;
  29. use App\Http\Controllers\Wap\Book\Transformers\ChapterTransformer;
  30. use App\Modules\Book\Services\BookConfigService;
  31. use App\Http\Controllers\Wap\Book\Transformers\ChapterListTransformer;
  32. use App\Modules\Subscribe\Services\BookOrderService;
  33. use App\Modules\Subscribe\Services\ChapterOrderService;
  34. use App\Modules\Subscribe\Services\YearOrderService;
  35. use App\Modules\OfficialAccount\Services\ForceSubscribeService;
  36. use App\Modules\Subscribe\Services\ChapterReminderService;
  37. use App\Modules\OfficialAccount\Services\OfficialAccountService;
  38. use Hashids;
  39. use GuzzleHttp\Client;
  40. use Log;
  41. use DB;
  42. use App\Modules\User\Services\UserSignService;
  43. use App\Modules\SendOrder\Services\SendOrderService;
  44. use App\Modules\User\Services\UserDeepReadTagService;
  45. use App\Modules\Book\Services\BookSubscribleChapterService;
  46. use App\Modules\Channel\Services\ChannelSubscribeSettingService;
  47. class ChapterController extends BaseController
  48. {
  49. /**
  50. * @apiDefine Chapter 章节
  51. */
  52. //用户是否强关
  53. private $is_had_subscribe = false;
  54. //章节是否需要强关
  55. private $is_need_subscribe;
  56. //用户信息
  57. private $user;
  58. //图书信息
  59. private $book_info;
  60. //cid
  61. private $cid;
  62. //加密的bid
  63. private $en_bid;
  64. //章节信息
  65. private $chapter;
  66. //强关时间
  67. private $force_subscribe_time = null;
  68. //关注的appid
  69. private $need_subscribe_appid;
  70. private $need_subscribe_name;
  71. private $is_first_book_order = 0;
  72. private $domain;
  73. /**
  74. * @apiVersion 1.0.0
  75. * @apiDescription 章节列表不分页
  76. * @api {get} books/{bid}/allcatalog 章节列表不分页
  77. * @apiGroup Chapter
  78. * @apiName getCatalog
  79. * @apiSuccess {int} code 状态码
  80. * @apiSuccess {String} msg 信息
  81. * @apiSuccess {object} data 结果集
  82. * @apiSuccess {Array} data.list 分页结果集
  83. * @apiSuccess {Int} data.list.bid bid
  84. * @apiSuccess {Int} data.list.chapter_id 章节id
  85. * @apiSuccess {String} data.list.chapter_name 章节名称
  86. * @apiSuccess {Int} data.list.chapter_sequence 序号
  87. * @apiSuccess {Int} data.list.chapter_is_vip 是否vip
  88. * @apiSuccess {Int} data.list.chapter_size 章节大小
  89. * @apiSuccess {Int} data.list.prev_cid 上一章节id
  90. * @apiSuccess {Int} data.list.next_cid 下一章节
  91. * @apiSuccess {String} data.list.recent_update_at 更新时间
  92. * @apiSuccess {String} data.list.is_need_subscirbe 是否强制关注
  93. * @apiSuccess {String} data.list.is_show_price 是否显示价格
  94. * @apiSuccess {String} data.list.price 价格
  95. * @apiSuccess {object} data.meta 分页信息
  96. * @apiSuccess {Int} data.meta.total 总条数
  97. * @apiSuccess {Int} data.meta.per_page 每页条数
  98. * @apiSuccess {Int} data.meta.current_page 当前页
  99. * @apiSuccess {Int} data.meta.last_page 最后页
  100. * @apiSuccess {String} data.meta.next_page_url 下一页
  101. * @apiSuccess {String} data.meta.prev_page_url 上一页
  102. * @apiSuccessExample {json} Success-Response:
  103. * HTTP/1.1 200 OK
  104. * {
  105. * code: 0,
  106. * msg: "",
  107. * data:
  108. * [
  109. * {
  110. * bid: 5,
  111. * chapter_id: 5,
  112. * chapter_name: "第1240章 不是我",
  113. * chapter_sequence: 1239,
  114. * chapter_is_vip: 1,
  115. * chapter_size: 2422,
  116. * prev_cid: 0,
  117. * next_cid: 0,
  118. * recent_update_at: 2017-11-20 15:01:56,
  119. * is_need_subscirbe: 1,
  120. * },
  121. * {
  122. * bid: 5,
  123. * chapter_id: 5,
  124. * chapter_name: "第1240章 不是我",
  125. * chapter_sequence: 1239,
  126. * chapter_is_vip: 1,
  127. * chapter_size: 2422,
  128. * prev_cid: 0,
  129. * next_cid: 0,
  130. * recent_update_at: 2017-11-20 15:01:56,
  131. * is_need_subscirbe: 1,
  132. * },
  133. * ]
  134. * }
  135. */
  136. public function getCatalog(Request $request, $t, $domain, $bid)
  137. {
  138. if (!$this->checkUid()) {
  139. return response()->error('WAP_NOT_LOGIN');
  140. }
  141. $this->en_bid = $bid;
  142. $bid = Hashids::decode($bid)[0];
  143. $lists = ChapterService::getChapterLists($bid);
  144. $book_info = BookConfigService::getBookById($bid);
  145. if (!$book_info) {
  146. return response()->error('PARAM_ERROR');
  147. }
  148. $this->book_info = $book_info;
  149. $is_show_price = $this->showChapterPrice($bid, $book_info->charge_type);
  150. foreach ($lists as $v) {
  151. $v->is_show_price = $is_show_price;
  152. $v->price = '';
  153. if ($is_show_price) {
  154. $v->price = $this->getPrice($book_info, $v);
  155. }
  156. }
  157. return response()->collection(new ChapterListTransformer, $lists);
  158. }
  159. /**
  160. * @apiVersion 1.0.0
  161. * @apiDescription 章节列表分页
  162. * @api {get} books/{bid}/catalog 章节列表分页
  163. * @apiGroup Chapter
  164. * @apiName getCatalogPerPage
  165. * @apiParam {Int} page_size 分页大小(默认15)
  166. * @apiParam {Int} page 页码(默认1)
  167. * @apiSuccess {int} code 状态码
  168. * @apiSuccess {String} msg 信息
  169. * @apiSuccess {object} data 结果集
  170. * @apiSuccess {Array} data.list 分页结果集
  171. * @apiSuccess {Int} data.list.bid bid
  172. * @apiSuccess {Int} data.list.chapter_id 章节id
  173. * @apiSuccess {String} data.list.chapter_name 章节名称
  174. * @apiSuccess {Int} data.list.chapter_sequence 序号
  175. * @apiSuccess {Int} data.list.chapter_is_vip 是否vip
  176. * @apiSuccess {Int} data.list.chapter_size 章节大小
  177. * @apiSuccess {Int} data.list.prev_cid 上一章节id
  178. * @apiSuccess {Int} data.list.next_cid 下一章节
  179. * @apiSuccess {String} data.list.recent_update_at 更新时间
  180. * @apiSuccess {String} data.list.is_need_subscirbe 是否强制关注
  181. * @apiSuccess {String} data.list.is_show_price 是否显示价格
  182. * @apiSuccess {String} data.list.price 价格
  183. * @apiSuccess {object} data.meta 分页信息
  184. * @apiSuccess {Int} data.meta.total 总条数
  185. * @apiSuccess {Int} data.meta.per_page 每页条数
  186. * @apiSuccess {Int} data.meta.current_page 当前页
  187. * @apiSuccess {Int} data.meta.last_page 最后页
  188. * @apiSuccess {String} data.meta.next_page_url 下一页
  189. * @apiSuccess {String} data.meta.prev_page_url 上一页
  190. * @apiSuccessExample {json} Success-Response:
  191. * HTTP/1.1 200 OK
  192. * {
  193. * code: 0,
  194. * msg: "",
  195. * data:
  196. * list:[
  197. * {
  198. * bid: 5,
  199. * chapter_id: 5,
  200. * chapter_name: "第1240章 不是我",
  201. * chapter_sequence: 1239,
  202. * chapter_is_vip: 1,
  203. * chapter_size: 2422,
  204. * prev_cid: 0,
  205. * next_cid: 0,
  206. * recent_update_at: 2017-11-20 15:01:56,
  207. * is_need_subscirbe: 1,
  208. * },
  209. * {
  210. * bid: 5,
  211. * chapter_id: 5,
  212. * chapter_name: "第1240章 不是我",
  213. * chapter_sequence: 1239,
  214. * chapter_is_vip: 1,
  215. * chapter_size: 2422,
  216. * prev_cid: 0,
  217. * next_cid: 0,
  218. * recent_update_at: 2017-11-20 15:01:56,
  219. * is_need_subscirbe: 1,
  220. * },
  221. * ]
  222. * meta:{
  223. * total: 1253,
  224. * per_page: 15,
  225. * current_page: 1,
  226. * last_page: 84,
  227. * next_page_url: "http://myapi.cn/api/books/1/chapter?page=2",
  228. * prev_page_url: ""
  229. * }
  230. * }
  231. */
  232. public function getCatalogPerPage(Request $request, $t, $domain, $bid)
  233. {
  234. if (!$this->checkUid()) {
  235. return response()->error('WAP_NOT_LOGIN');
  236. }
  237. $this->en_bid = $bid;
  238. $bid_array = Hashids::decode($bid);
  239. if (isset($bid_array[0])) {
  240. $bid = $bid_array[0];
  241. } else {
  242. return response()->error('PARAM_ERROR');
  243. }
  244. $book_info = BookConfigService::getBookById($bid);
  245. if (!$book_info) {
  246. return response()->error('PARAM_ERROR');
  247. }
  248. $this->book_info = $book_info;
  249. $page_size = $request->input('page_size', 15);
  250. if($page_size>=100) $page_size=100;
  251. $res = ChapterService::getChapterListsPage($bid, $page_size);
  252. $is_show_price = $this->showChapterPrice($bid, $book_info->charge_type);
  253. foreach ($res as $v) {
  254. $v->is_show_price = $is_show_price;
  255. $v->price = '';
  256. if ($is_show_price) {
  257. $v->price = $this->getPrice($book_info, $v);
  258. }
  259. }
  260. return response()->pagination(new ChapterListTransformer, $res);
  261. }
  262. /**
  263. * @apiVersion 1.0.0
  264. * @apiDescription 章节内容
  265. * @api {get} books/{bid}/chapters/{chapter_id} 章节内容
  266. * @apiGroup Chapter
  267. * @apiName index
  268. * @apiSuccess {int} code 状态码
  269. * @apiSuccess {String} msg 信息
  270. * @apiSuccess {object} data 结果集
  271. * @apiSuccess {Int} data.chapter_id 章节id
  272. * @apiSuccess {String} data.chapter_name 章节名称
  273. * @apiSuccess {Int} data.chapter_sequence 序号
  274. * @apiSuccess {Int} data.chapter_is_vip 是否vip
  275. * @apiSuccess {Int} data.chapter_size 章节大小
  276. * @apiSuccess {Int} data.prev_cid 上一章节id
  277. * @apiSuccess {Int} data.next_cid 下一章节
  278. * @apiSuccess {String} data.recent_update_at 更新时间
  279. * @apiSuccess {String} data.chapter_content 章节内容
  280. * @apiSuccess {Int} data.is_need_subscirbe 是否强制关注(删除)
  281. * @apiSuccess {Int} data.is_show_subscribe_link 是否显示底部强关链接
  282. * @apiSuccessExample {json} Success-Response:
  283. * HTTP/1.1 200 OK
  284. * {
  285. * code: 0,
  286. * msg: "",
  287. * data: {
  288. * chapter_id: 5,
  289. * chapter_name: "第1240章 不是我",
  290. * chapter_sequence: 1239,
  291. * chapter_is_vip: 1,
  292. * chapter_size: 2422,
  293. * prev_cid: 0,
  294. * next_cid: 0,
  295. * recent_update_at: 2017-11-20 15:01:56,
  296. * chapter_content: "叶妩被司行霈的阴阳怪气一吓,思路偏得太远了。 她张口结舌,忘记了自己要说什么。",
  297. * }
  298. * }
  299. */
  300. public function index(Request $request, $t, $domain, $bid, $cid)
  301. {
  302. $this->domain = $domain;
  303. $special_user_log = env('SPECIAL_USER_LOG');
  304. //注意:内部约定用 有此参数不需要强关
  305. $inter_not_need_sub = $request->has('inter_not_need_sub') ? true : false;
  306. $ad_status = $request->get('ad_status');
  307. //$ad_status = 0;
  308. $has_force_show_qrcode_cookie = Cookie::get('force_show_qrcode');
  309. Cookie::queue('force_show_qrcode', 1, -1);
  310. if (!$this->checkUid()) {
  311. myLog('special')->info('chapter index controller---$this->checkUid() fail-------');
  312. return response()->error('WAP_NOT_LOGIN');
  313. }
  314. if($special_user_log && $special_user_log == $this->uid){
  315. $my_log = myLog('special');
  316. $my_log->info('in chapters--------------------------');
  317. $my_log->info('param is');
  318. $my_log->info($request->all());
  319. $my_log->info('$t is: '.$t);
  320. $my_log->info('$domain is: '.$domain);
  321. $my_log->info('$bid is: '.$bid);
  322. $my_log->info('$cid is: '.$cid);
  323. $my_log->info('$uri is: '. $request->path());
  324. }
  325. $this->en_bid = $bid;
  326. $bid = explode(',',$bid)[0];
  327. $bid = Hashids::decode($bid)[0];
  328. if($special_user_log && $special_user_log == $this->uid){
  329. myLog('special')->info('decode bid is: '.$bid);
  330. }
  331. //获取图书信息
  332. $book_info = BookConfigService::getBookById($bid);
  333. if($special_user_log && $special_user_log == $this->uid){
  334. $my_log = myLog('special');
  335. $my_log->info('book_info is ');
  336. $my_log->info($book_info);
  337. }
  338. //是否开启全站按章模式
  339. $global_charge_by_chapter_channels = explode(',',env('GLOBAL_CHARGE_BY_CHAPTER_CHANNEL'));
  340. if(in_array($this->distribution_channel_id,$global_charge_by_chapter_channels))
  341. {
  342. $book_info->charge_type = 'CHAPTER';
  343. }
  344. if (empty($book_info)) return response()->error('WAP_SYS_ERROR');
  345. if($special_user_log && $special_user_log == $this->uid){
  346. $my_log = myLog('special');
  347. $my_log->info('book info ok--------------------------');
  348. }
  349. $this->book_info = $book_info;
  350. $this->cid = $cid;
  351. //下架图书不能看
  352. if ($this->isOffShelf()) {
  353. return response()->error('WAP_OFF_SHELF');
  354. }
  355. if($special_user_log && $special_user_log == $this->uid){
  356. $my_log = myLog('special');
  357. $my_log->info('on shelf ok--------------------------');
  358. }
  359. //获取章节信息
  360. $chapter = ChapterService::getChapterNameById($cid, $bid);
  361. $this->chapter = $chapter;
  362. if($special_user_log && $special_user_log == $this->uid){
  363. $my_log = myLog('special');
  364. $my_log->info('chapters-info--is-----------------------');
  365. $my_log->info($chapter);
  366. }
  367. //章节被删除
  368. if (($is_delete = $this->chapterNotExists())) {
  369. if($special_user_log && $special_user_log == $this->uid){
  370. $my_log = myLog('special');
  371. $my_log->info('chapters-----delete---------------------');
  372. }
  373. return response()->error('WAP_DOMAIN_NOT_MATCH', [
  374. 'url' => $is_delete
  375. ]);
  376. }
  377. if(($result = $this->forceGuidePerson())){
  378. return response()->error('WAP_DOMAIN_NOT_MATCH', [
  379. 'url' => $result
  380. ]);
  381. }
  382. /*//强制导粉
  383. //$force_guide_sites = redisEnv('FORCE_GUIDE_SITES');
  384. //$img = redisEnv('GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE');
  385. list($force_guide_sites,$img) = redisEnvMulti('GUIDE_PERSONAL_ACCOUNT_SITES','FORCE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE');
  386. if($force_guide_sites &&
  387. $img &&
  388. in_array($this->distribution_channel_id,explode(',',$force_guide_sites)) &&
  389. $this->is_paid &&
  390. ($this->chapter->sequence == 2 || $this->chapter->sequence == 8)&&
  391. !UserBindHkWelfareService::isHasGet($this->uid) &&
  392. ForceGuidePersonAccountService::isShow($this->uid,$bid,$cid)
  393. ){
  394. return response()->error('WAP_DOMAIN_NOT_MATCH', [
  395. 'url' => sprintf('/force/guide?bid=%s&cid=%s&book_name=%s&prev_cid=%s',$this->en_bid,$cid,$book_info->book_name,$this->chapter->prev_cid)
  396. ]);
  397. }*/
  398. if($special_user_log && $special_user_log == $this->uid){
  399. $my_log = myLog('special');
  400. $my_log->info('chapters-----ok---------------------');
  401. }
  402. //获取强关章节数
  403. $subscribe_seq = $this->getSubscribeChapterNum($book_info);
  404. //章节是否需要强关 TRUE:不需要,false:需要
  405. $force_subscribe = $subscribe_seq > $chapter->sequence;
  406. $this->is_need_subscribe = !$force_subscribe;
  407. //图书域名,book_configs表的promotion_domain 要跟当前的主机名匹配 在强关章节后3章
  408. $visit_domain_check_seq = $subscribe_seq + 3;
  409. $is_forced_check_domain = false;
  410. $force_domain_iycdm_bids = explode(',',env('FORCE_DOMAIN_IYCDM_BIDS'));
  411. $force_domain_leyuee_bids = explode(',',env('FORCE_DOMAIN_LEYUEE_BIDS'));
  412. $force_domain_bids = [
  413. 'iycdm.com'=>$force_domain_iycdm_bids,
  414. 'leyuee.com'=>$force_domain_leyuee_bids
  415. ];
  416. //强制走指定域名
  417. foreach ($force_domain_bids as $_force_domain=>$_force_domain_bid)
  418. {
  419. if(in_array($bid,$_force_domain_bid))
  420. {
  421. $is_forced_check_domain = true;
  422. $visit_domain_check_seq = 0;
  423. $this->book_info->promotion_domain = $_force_domain;break;
  424. }
  425. }
  426. if ($this->isVisitDomainNotEqualBookDomain($domain, $visit_domain_check_seq, $is_forced_check_domain) ) {
  427. if($special_user_log && $special_user_log == $this->uid){
  428. $my_log = myLog('special');
  429. $my_log->info('book domain not match------------------------');
  430. }
  431. return response()->error('WAP_DOMAIN_NOT_MATCH', [
  432. 'url' => $this->getCorrespondBookUrl()
  433. ]);
  434. }
  435. if($special_user_log && $special_user_log == $this->uid){
  436. $my_log = myLog('special');
  437. $my_log->info('book domain jump--------------------------');
  438. }
  439. $user_info = $this->_user_info;
  440. $this->user = $user_info;
  441. //用户是否强关
  442. $this->is_had_subscribe = $is_had_subscribe = $inter_not_need_sub ? true : $this->getSubscribe();
  443. //判断当前是否有强制显示服务号信息的cookie、已经关注 跳转到服务号信息引导页
  444. if($has_force_show_qrcode_cookie && $is_had_subscribe)
  445. {
  446. if($special_user_log && $special_user_log == $this->uid){
  447. $my_log = myLog('special');
  448. $my_log->info('do not have force show qrcode cookie-------------------------');
  449. }
  450. $force_read_url = '/subscribe/getFromUser';//服务号信息引导页
  451. $force_read_data = ['src' => $force_read_url];
  452. return response()->error('WAP_NOT_SUBSCRIBE', $force_read_data);
  453. }
  454. if($special_user_log && $special_user_log == $this->uid){
  455. $my_log = myLog('special');
  456. $my_log->info('has force show qrcode cookie-ok-------------------------');
  457. }
  458. if ($force_subscribe || $chapter->is_vip == 0) {
  459. //vip前一张和枪管前一张的访问统计
  460. $this->beforeForceSubAndBeforeVipUvAndPv($book_info, $subscribe_seq, $chapter);
  461. }
  462. //不用关注且不是vip章节
  463. if ($force_subscribe && $chapter->is_vip == 0) {
  464. //获取公共号
  465. $officialAccount = $this->getOfficialAccount();
  466. $this->chapter->is_show_subscribe_link = 0;
  467. //非强关,但是设置了弱关,阅读页底部显示强关链接
  468. if ($officialAccount && isset($officialAccount->appid) && !empty($officialAccount->appid)) {
  469. $sub_type = $this->getSubscribeType($officialAccount->appid, $bid);
  470. if (in_array(2, $sub_type['type']) && !$is_had_subscribe) {
  471. $this->chapter->is_show_subscribe_link = 1;
  472. }
  473. }
  474. if($special_user_log && $special_user_log == $this->uid){
  475. $my_log = myLog('special');
  476. $my_log->info('do not force subscribe-and is not vip-------------------------');
  477. }
  478. $this->getChapter();
  479. return response()->item(new ChapterTransformer, $this->chapter);
  480. }
  481. if($special_user_log && $special_user_log == $this->uid){
  482. $my_log = myLog('special');
  483. $my_log->info('11111111111111111111111111111111111111111');
  484. }
  485. //需要强制关注 不是vip章节 已经关注了
  486. if (!$force_subscribe && $chapter->is_vip == 0 && $is_had_subscribe) {
  487. $this->getChapter();
  488. return response()->item(new ChapterTransformer, $this->chapter);
  489. }
  490. if($special_user_log && $special_user_log == $this->uid){
  491. $my_log = myLog('special');
  492. $my_log->info('222222222222222222222222222222222222222');
  493. }
  494. //需要强制关注 没关注
  495. if ((!$force_subscribe) && !$is_had_subscribe) {
  496. $force_data = $this->forceSubscribe();
  497. if ($force_data) {
  498. $this->subscribeStats();
  499. if($special_user_log && $special_user_log == $this->uid){
  500. $my_log = myLog('special');
  501. $my_log->info('need subscribe-------------------------');
  502. }
  503. //阅读记录
  504. ReadRecordService::addReadRecord(['uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
  505. 'cid' => $cid, 'chapter_name' => $chapter->name]);
  506. return response()->error($force_data['error_type'], $force_data['data']);
  507. }
  508. //取不到公众号则不用强关
  509. if ($chapter->is_vip == 0) {
  510. $this->getChapter();
  511. if($special_user_log && $special_user_log == $this->uid){
  512. $my_log = myLog('special');
  513. $my_log->info('official fail--------------------------');
  514. }
  515. return response()->item(new ChapterTransformer, $this->chapter);
  516. }
  517. }
  518. if($special_user_log && $special_user_log == $this->uid){
  519. $my_log = myLog('special');
  520. $my_log->info('33333333333333333333333333333333333333333');
  521. }
  522. //已经付费
  523. if ($this->getOrderRecord($bid, $cid)) {
  524. $this->getChapter();
  525. if($special_user_log && $special_user_log == $this->uid){
  526. $my_log = myLog('special');
  527. $my_log->info('had order order record--------------------------');
  528. }
  529. return response()->item(new ChapterTransformer, $this->chapter);
  530. }
  531. if($special_user_log && $special_user_log == $this->uid){
  532. $my_log = myLog('special');
  533. $my_log->info('4444444444444444444444444444444444444444444');
  534. }
  535. //获取价格
  536. $fee = $this->getPrice($book_info, $chapter);
  537. //广告
  538. if($this->isUserInAdSample() && $ad_status && $ad_status == 1 && $user_info->balance < $fee){
  539. if($special_user_log && $special_user_log == $this->uid){
  540. $my_log = myLog('special');
  541. $my_log->info('ad-----in--------------------');
  542. }
  543. //广告解锁2张
  544. /*if($this->chapter->next_cid){
  545. $next_chapter = ChapterService::getChapterNameById($this->chapter->next_cid, $bid);
  546. if($next_chapter){
  547. $next_chapter_name = $next_chapter->name;
  548. $this->bookOrderOrChapterOrder($book_info, $this->chapter->next_cid, 0, $next_chapter_name, 1);
  549. AdVisitStatService::create($this->uid,$this->book_info->bid,$this->chapter->next_cid,'UNLOCK_2');
  550. }
  551. }*/
  552. //$this->chapter->is_show_ad = 0;
  553. $result = AdVisitStatService::getInfoV2($this->uid, $cid, ['UNLOCK', 'UNLOCK_2']);
  554. if ($result){
  555. $this->getChapter();
  556. $this->bookOrderOrChapterOrder($book_info, $cid, 0, $chapter->name, 1);
  557. return response()->item(new ChapterTransformer, $this->chapter);
  558. }
  559. }
  560. if($special_user_log && $special_user_log == $this->uid){
  561. $my_log = myLog('special');
  562. $my_log->info('5555555555555555555555555555555555');
  563. }
  564. //以上都是不用付费的情况******************************************************
  565. //未付费
  566. //返回的价格信息
  567. $data = [
  568. 'book_id' => $this->en_bid,
  569. 'book_name' => $book_info->book_name,
  570. 'chapter_name' => $chapter->name,
  571. 'chapter_id' => $cid,
  572. 'pay_type' => $book_info->charge_type,
  573. 'fee' => $fee,
  574. 'user_balance' => $user_info->balance,
  575. 'product_id' => $book_info->product_id,
  576. 'uid' => $this->uid,
  577. 'distribution_channel_id' => $this->distribution_channel_id,
  578. 'is_discount' => 0,
  579. 'discount_fee' => '',
  580. 'discount' => '',
  581. 'is_first_book_order'=>$this->is_first_book_order
  582. ];
  583. if($special_user_log && $special_user_log == $this->uid){
  584. $my_log = myLog('special');
  585. $my_log->info('data is:');
  586. $my_log->info($data);
  587. }
  588. //余额不足 弹窗提醒
  589. if ($user_info['balance'] < $fee) {
  590. if($special_user_log && $special_user_log == $this->uid){
  591. $my_log = myLog('special');
  592. $my_log->info('balance is lack');
  593. $my_log->info('user balance is: '.$user_info['balance']);
  594. $my_log->info('fee is: '.$fee);
  595. }
  596. //$this->smartPushTestBookPayPageUv($bid);
  597. //$this->sendOrderPayPageUv($bid);
  598. //除了单本订购 其他的都不提醒,直接跳转到充值页面
  599. if ($book_info->charge_type == 'CHAPTER') {
  600. if($special_user_log && $special_user_log == $this->uid){
  601. $my_log = myLog('special');
  602. $my_log->info('chapter order balance lack');
  603. }
  604. return response()->error('WAP_CHAPTER_SECOND_BALANCE_PAY', $data);
  605. }
  606. //需要提箱
  607. if ($this->isOrderRemind($bid)) {
  608. if($special_user_log && $special_user_log == $this->uid){
  609. $my_log = myLog('special');
  610. $my_log->info('balance lack remind');
  611. }
  612. return response()->error('WAP_BOOK_BALANCE_PAY', $data);
  613. //return response()->error('WAP_BOOK_SECOND_BALANCE_PAY', $data);
  614. } else {
  615. if($special_user_log && $special_user_log == $this->uid){
  616. $my_log = myLog('special');
  617. $my_log->info('balance lack not remind');
  618. }
  619. return response()->error('WAP_BOOK_SECOND_BALANCE_PAY', $data);
  620. }
  621. }
  622. if($special_user_log && $special_user_log == $this->uid){
  623. $my_log = myLog('special');
  624. $my_log->info('6666666666666666666666666666666666666');
  625. }
  626. //余额充足 单本弹窗提醒,章节直接扣费
  627. if ($this->isOrderRemind($bid) && $book_info->charge_type == 'BOOK') {
  628. if($special_user_log && $special_user_log == $this->uid){
  629. $my_log = myLog('special');
  630. $my_log->info('balance enough remind');
  631. }
  632. return response()->error('WAP_BOOK_BUY', $data);
  633. }
  634. if($special_user_log && $special_user_log == $this->uid){
  635. $my_log = myLog('special');
  636. $my_log->info('77777777777777777777777777777');
  637. }
  638. //付费 不提醒
  639. if ($this->balancePay($book_info, $chapter, 0)) {
  640. if($special_user_log && $special_user_log == $this->uid){
  641. $my_log = myLog('special');
  642. $my_log->info('balance pay ok-----');
  643. }
  644. $this->getChapter();
  645. return response()->item(new ChapterTransformer, $this->chapter);
  646. } else {
  647. if($special_user_log && $special_user_log == $this->uid){
  648. $my_log = myLog('special');
  649. $my_log->info('balance pay fails!!!!!!!!!!!!!!!!');
  650. }
  651. //付费 异常
  652. return response()->error('WAP_SYS_ERROR');
  653. }
  654. }
  655. /**
  656. * @apiVersion 1.0.0
  657. * @apiDescription 余额支付
  658. * @api {get} books/{bid}/balance/chapterOrders/{cid} 余额支付
  659. * @apiGroup Chapter
  660. * @apiName pay
  661. * @apiParam (Int) remind 提醒
  662. * @apiSuccess {int} code 状态码
  663. * @apiSuccess {String} msg 信息
  664. * @apiSuccess {object} data 结果集
  665. * @apiSuccess {Int} data.chapter_id 章节id
  666. * @apiSuccess {String} data.chapter_name 章节名称
  667. * @apiSuccess {Int} data.chapter_sequence 序号
  668. * @apiSuccess {Int} data.chapter_is_vip 是否vip
  669. * @apiSuccess {Int} data.chapter_size 章节大小
  670. * @apiSuccess {Int} data.prev_cid 上一章节id
  671. * @apiSuccess {Int} data.next_cid 下一章节
  672. * @apiSuccess {String} data.recent_update_at 更新时间
  673. * @apiSuccess {String} data.chapter_content 章节内容
  674. * @apiSuccess {Int} data.is_need_subscirbe 是否强制关注(删除)
  675. * @apiSuccessExample {json} Success-Response:
  676. * HTTP/1.1 200 OK
  677. * {
  678. * code: 0,
  679. * msg: "",
  680. * data: {
  681. * chapter_id: 5,
  682. * chapter_name: "第1240章 不是我",
  683. * chapter_sequence: 1239,
  684. * chapter_is_vip: 1,
  685. * chapter_size: 2422,
  686. * prev_cid: 0,
  687. * next_cid: 0,
  688. * recent_update_at: 2017-11-20 15:01:56,
  689. * chapter_content: "叶妩被司行霈的阴阳怪气一吓,思路偏得太远了。 她张口结舌,忘记了自己要说什么。",
  690. * }
  691. * }
  692. */
  693. public function pay(Request $request, $t, $domain, $bid, $cid)
  694. {
  695. if (!$this->checkUid()) {
  696. return response()->error('NOT_LOGIN');
  697. }
  698. $remind = (int)$request->input('remind');
  699. $this->en_bid = $bid;
  700. $oldbid = $bid;
  701. $bid = Hashids::decode($bid)[0];
  702. $book_info = BookConfigService::getBookById($bid);;
  703. if (empty($book_info)) response()->error('WAP_SYS_ERROR');
  704. //获取章节
  705. $chapter = ChapterService::getChapterNameById($cid, $bid);
  706. if (!$chapter) {
  707. return response()->error('WAP_SYS_ERROR');
  708. }
  709. $this->chapter = $chapter;
  710. $this->book_info = $book_info;
  711. $this->cid = $cid;
  712. if ($this->balancePay($book_info, $chapter, $remind)) {
  713. ReadRecordService::addReadRecord(['uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
  714. 'cid' => $cid, 'chapter_name' => $chapter->name]);
  715. $this->getChapter();
  716. return response()->item(new ChapterTransformer, $this->chapter);
  717. } else {
  718. $fee = $this->getPrice($book_info, $chapter);
  719. $data = [
  720. 'book_id' => $oldbid,
  721. 'book_name' => $book_info->book_name,
  722. 'chapter_name' => $chapter->name,
  723. 'chapter_id' => $cid,
  724. 'pay_type' => $book_info->charge_type,
  725. 'fee' => $fee,
  726. 'user_balance' => $this->_user_info['balance'],
  727. 'product_id' => $book_info->product_id,
  728. 'uid' => $this->uid,
  729. 'distribution_channel_id' => $this->distribution_channel_id,
  730. 'is_discount' => 0,
  731. 'discount_fee' => '',
  732. 'discount' => '',
  733. 'is_first_book_order'=>$this->is_first_book_order
  734. ];
  735. //不需要提醒
  736. if ($book_info->charge_type == 'BOOK') {
  737. return response()->error('WAP_BOOK_SECOND_BALANCE_PAY', $data);
  738. } elseif ($book_info->charge_type == 'CHAPTER') {
  739. return response()->error('WAP_CHAPTER_SECOND_BALANCE_PAY', $data);
  740. } else {
  741. return response()->error('WAP_SYS_ERROR');
  742. }
  743. }
  744. }
  745. /**
  746. * 余额支付
  747. * @param $book_info
  748. * @param $chapter_id
  749. * @param $chapter_size
  750. * @return bool
  751. */
  752. protected function balancePay($book_info, $chapter, $is_remind)
  753. {
  754. $fee = $this->getPrice($book_info, $chapter);
  755. if ((int)$this->_user_info['balance'] >= $fee) {
  756. if ($this->bookOrderOrChapterOrder($book_info, $chapter->id, $fee, $chapter->name, $is_remind)) {
  757. $this->chapterOrderStats($fee);
  758. if($this->user){
  759. $this->user->balance -= $fee;
  760. }
  761. $this->customChapterOrderStats($fee);
  762. $this->crmChapterStats($fee);
  763. return true;
  764. }
  765. }
  766. return false;
  767. }
  768. /**
  769. * 获取章节内容
  770. * @param $bid
  771. * @param $cid
  772. * @return bool|mixed
  773. */
  774. private function getChapter()
  775. {
  776. //初始化 默认字段
  777. $this->initChapterDefaultField();
  778. //章节内容
  779. $chapter_content = ChapterService::getChapter($this->book_info->bid, $this->cid);
  780. //$this->chapter->content = str_replace($chapter_content->name, '', $chapter_content->content);
  781. $this->chapter->content = $chapter_content->content;
  782. //阅读记录
  783. if($this->chapter->sequence >= 2){
  784. ReadRecordService::addReadRecord(['uid' => $this->uid, 'bid' => $this->book_info->bid, 'book_name' => $this->book_info->book_name,
  785. 'cid' => $this->cid, 'chapter_name' => $this->chapter->name]);
  786. }
  787. //统计
  788. $this->chapterStats();
  789. //123特殊强关
  790. $this->specialSubscribeFlag();
  791. //签到奖励
  792. //$this->sign();
  793. //#短篇推送长篇需求#
  794. //$this->shortPushLong();
  795. //#短推长、短推短对比
  796. //$this->shortPushshort();
  797. //阅读器分享
  798. $this->share();
  799. //广告
  800. $this->isShowAd();
  801. //完整阅读纪录 阅读纪录
  802. $this->readRecordOther();
  803. }
  804. /**
  805. * 章节阅读接口需要配置返回的字段
  806. */
  807. private function initChapterDefaultField()
  808. {
  809. if (!$this->chapter) {
  810. return;
  811. }
  812. //内容
  813. $this->chapter->content = '';
  814. //签到默认字段
  815. $this->chapter->sign_days = 1;
  816. $this->chapter->sign_status = 0;
  817. $this->chapter->sign_reard = 0;
  818. $this->chapter->sign_version = 'v1';
  819. $this->chapter->sign_items = [];//只有v2签到才会用到的字段
  820. //#短篇推送长篇需求#
  821. $this->chapter->next_jump = 0;
  822. $this->chapter->next_jump_url = '';
  823. $this->chapter->show_push_title = 0;
  824. $this->chapter->push_title_url = '';
  825. $this->chapter->push_title = [];
  826. //分享
  827. $this->chapter->is_show_share_button = 0;
  828. //6985的分享配置
  829. $this->chapter->share_config = '';
  830. //阅读底部强关图片 只有123有
  831. $this->chapter->is_had_subscribe = 0;
  832. //广告
  833. $this->chapter->is_show_ad = 0;//可不可点击
  834. $this->chapter->is_visiable_ad = 0;//可不可显示
  835. }
  836. private function sign()
  837. {
  838. //渠道123 未关注的签到放到强关前一章
  839. if ($this->distribution_channel_id == 123 && !$this->is_had_subscribe) {
  840. if ($this->book_info->force_subscribe_chapter_seq - 1 == $this->chapter->sequence) {
  841. $sign_status = $this->userSign($this->uid);
  842. //$sign_status = 0;
  843. $this->chapter->sign_status = $sign_status ? 1 : 0;
  844. $this->chapter->sign_reard = $sign_status;
  845. $this->chapter->sign_days = ReadRecordService::getSignCount($this->uid);
  846. if($this->chapter->sign_days && $this->chapter->sign_days>=8){
  847. $this->chapter->sign_items = $fee_pool = [50,50,120,50,50,50,150];
  848. }else{
  849. $this->chapter->sign_items = $fee_pool = [30,50,120,50,50,50,150];
  850. }
  851. }
  852. } else {
  853. $sign_status = $this->userSign($this->uid);
  854. //$sign_status =0;
  855. $this->chapter->sign_status = $sign_status ? 1 : 0;
  856. $this->chapter->sign_reard = $sign_status;
  857. $this->chapter->sign_days = ReadRecordService::getSignCount($this->uid);
  858. if($this->chapter->sign_days && $this->chapter->sign_days>=8){
  859. $this->chapter->sign_items = $fee_pool = [50,50,120,50,50,50,150];
  860. }else{
  861. $this->chapter->sign_items = $fee_pool = [30,50,120,50,50,50,150];
  862. }
  863. }
  864. }
  865. private function forceSubscribe()
  866. {
  867. if($this->need_subscribe_appid){
  868. $src = $this->getRcodeInfo(['appid' => $this->need_subscribe_appid], $this->book_info->bid);
  869. if (empty($src)) return false;
  870. $url = '/subscribe/qrcode?img=' . urlencode($src) . '&title=' . $this->need_subscribe_name . '&uid=' . $this->uid;
  871. return ['error_type' => 'WAP_NOT_SUBSCRIBE', 'data' => ['src' => $url, 'head_img' => '']];
  872. }
  873. //获取公众号信息
  874. $officialAccount = $this->getOfficialAccount();
  875. if (!$officialAccount || empty($officialAccount->appid)) {
  876. return false;
  877. }
  878. //如果是链接强关,则跳转
  879. $sub_type = $this->getSubscribeType($officialAccount->appid, $this->book_info->bid);
  880. if (in_array(3, $sub_type['type']) && $sub_type['url']) {
  881. return ['error_type' => 'WAP_LINK_SUBSCRIBE', 'data' => ['url' => $sub_type['url']]];
  882. }
  883. //普通强关
  884. if (in_array(1, $sub_type['type'])) {
  885. $src = $this->getRcodeInfo(['appid' => $officialAccount->appid], $this->book_info->bid);
  886. if (empty($src)) return false;
  887. if ($officialAccount->head_img) {
  888. $url = '/subscribe/qrcode?img=' . urlencode($src) . '&title=' . $officialAccount->nickname . '&head_img=' . urlencode($officialAccount->head_img) . '&uid=' . $this->uid;
  889. } else {
  890. $url = '/subscribe/qrcode?img=' . urlencode($src) . '&title=' . $officialAccount->nickname . '&uid=' . $this->uid;
  891. }
  892. return ['error_type' => 'WAP_NOT_SUBSCRIBE', 'data' => ['src' => $url, 'head_img' => $officialAccount->head_img]];
  893. }
  894. return false;
  895. }
  896. //强关页面的统计
  897. private function subscribeStats()
  898. {
  899. if ($this->send_order_id) {
  900. //$this->sendOrderSubscribePageUv($this->book_info->bid);
  901. //强关页面的uv
  902. /*try {
  903. Redis::sadd('subscribe_page_uv' . $this->send_order_id, $this->uid);
  904. Redis::sadd('subscribe_page_uv_send_order_ids', $this->send_order_id);
  905. } catch (\Exception $e) {
  906. }*/
  907. }
  908. }
  909. /**
  910. * 短推长
  911. */
  912. private function shortPushLong()
  913. {
  914. if ($this->book_info->charge_type = 'CHAPTER') return;
  915. $is_has_book_order = BookOrderService::isHasBookOrder($this->uid);
  916. if ($this->chapter->is_vip && $is_has_book_order) {
  917. $this->chapter->show_push_title = 1;
  918. $this->chapter->push_title = DataAnalysisBookConfig::getUserReaderPagePushBook($this->uid, $this->distribution_channel_id);
  919. }
  920. if (!$this->chapter->next_cid && $is_has_book_order) {
  921. $link = DataAnalysisBookConfig::getUserReaderPagePushBook($this->uid, $this->distribution_channel_id, 1);
  922. if ($link && isset($link['link']) && !empty($link['link'])) {
  923. $this->chapter->next_jump = 1;
  924. $this->chapter->next_jump_url = $link['link'];
  925. }
  926. }
  927. }
  928. /**
  929. * 短推长、短推短对比需求
  930. * 目标用户:全站短篇进入新注册且订阅短篇的付费用户
  931. * 方式:根据uid奇偶取用,奇:测试用户1 偶:测试用户2
  932. * 测试用户1:底部链接+完本推荐 均使用短篇小说
  933. * 测试用户2:底部链接+完本推荐 均使用长篇小说
  934. * 目标用户:全站短篇进入新注册且订阅短篇的付费用户
  935. */
  936. private function shortPushshort()
  937. {
  938. //新用户 注册时间大于某个值
  939. if(!$this->user){
  940. return ;
  941. }
  942. if(!env('SHORT_PUSH_SHORT_START_TIME') || strtotime($this->user->created_at) < env('SHORT_PUSH_SHORT_START_TIME')){
  943. return ;
  944. }
  945. //没有派单
  946. if(!$this->user->send_order_id) return ;
  947. //只在vip章节底部显示
  948. if(!$this->chapter->is_vip){
  949. return ;
  950. }
  951. //强关
  952. if(!$this->is_had_subscribe){
  953. return ;
  954. }
  955. //短篇进入
  956. $send_order_info = SendOrderService::getById($this->user->send_order_id);
  957. if(!$send_order_info || $send_order_info->charge_type != 'BOOK'){
  958. return ;
  959. }
  960. //订阅短篇的付费用户
  961. $is_has_book_order = BookOrderService::isHasBookOrder($this->uid);
  962. if(!$is_has_book_order) return ;
  963. //是否付费用户
  964. if(!OrderService::isPaidUser($this->uid)) return ;
  965. $type = $this->uid %2 == 1? 'BOOK':'CHAPTER';
  966. $result = DataAnalysisSelectUserService::create($this->uid, $this->distribution_channel_id, $type, 500, $attach = 'short2s2l');
  967. if(!$result) return ;
  968. //底部链接
  969. $this->chapter->show_push_title = 1;
  970. $this->chapter->push_title = DataAnalysisBookConfig::getUserReaderPagePushBookV2($this->uid, $this->distribution_channel_id,$type);
  971. //完本推荐
  972. if (!$this->chapter->next_cid ) {
  973. $link = DataAnalysisBookConfig::getUserReaderPagePushBookV2($this->uid, $this->distribution_channel_id,$type, 1);
  974. if($link && $link['link']){
  975. $this->chapter->next_jump = 1;
  976. $this->chapter->next_jump_url = $link['link'];
  977. }
  978. }
  979. }
  980. private function share()
  981. {
  982. if ($this->is_had_subscribe && in_array($this->distribution_channel_id, [2, 14, 211,4025,4147,691,123]) && $this->user) {//,4147,691,123,4025
  983. $this->chapter->is_show_share_button = 1;
  984. }
  985. if($this->distribution_channel_id == 6985 && $this->domain == 'leyuee'){
  986. $appid = 'wx126331d1732978b0';
  987. $appSecret = '76231c41c24d4363243866f5f9dee55f';
  988. $config = new ChapterShareWechatConfigService($appid,$appSecret);
  989. //$config->setAccessToken('');
  990. $config->requestAccessToken();
  991. $config->requestJsApiTicket();
  992. $url = sprintf(
  993. 'https://site%s.leyuee.com/reader?bid=%s&cid=%s',
  994. $this->en_distribution_channel_id,
  995. $this->en_bid,
  996. $this->cid
  997. );
  998. $this->chapter->share_config = $config->getJssdkConfig($url);
  999. }
  1000. }
  1001. /**
  1002. * 123 渠道阅读底部强关图片
  1003. */
  1004. private function specialSubscribeFlag()
  1005. {
  1006. if ($this->distribution_channel_id == 123 && !$this->is_had_subscribe) {
  1007. $this->chapter->is_had_subscribe = 1;
  1008. }
  1009. }
  1010. //订阅统计
  1011. private function chapterOrderStats($fee)
  1012. {
  1013. $day = date('Y--m-d');
  1014. try {
  1015. Redis::hincrby('wap:chapterandbookorder:bid:' . $this->book_info->bid, $day, $fee);
  1016. } catch (\Exception $e) {
  1017. }
  1018. $this->smartPushTestBook($this->book_info->bid, $fee);
  1019. $specialChannelIdStats = env('SPECIAL_CHANNEL_STATS', 211);
  1020. if (in_array($this->distribution_channel_id, explode(',', $specialChannelIdStats))) {
  1021. WapVisitStatService::specialChannelIdStatsSave($this->uid, $this->book_info->bid, $fee);
  1022. }
  1023. }
  1024. /**
  1025. * 签到
  1026. * @param $uid
  1027. * @return int
  1028. */
  1029. protected function userSign($uid)
  1030. {
  1031. if (UserSignService::isSign($uid)) {
  1032. //签过到了
  1033. return 0;
  1034. }
  1035. /*if(in_array($this->distribution_channel_id,explode(',',redisEnv('NEW_SIGN_CHANNELS','')))){
  1036. $version = UserSignService::getUserSignVersion($this->uid);
  1037. }else{
  1038. $version = 'v1';
  1039. }*/
  1040. $version = UserSignService::getUserSignVersion($this->uid);
  1041. $this->chapter->sign_version = $version;
  1042. if ($res = UserSignService::signToday($uid,$this->chapter->sign_version)) {
  1043. //$sign_key = 'leyuee:wap:usersigni';
  1044. //Redis::hset($sign_key, $uid, $res);
  1045. return $res;
  1046. }
  1047. return 0;
  1048. }
  1049. /**
  1050. * 添加订购记录
  1051. * @param $book_info
  1052. * @param $chapter_id
  1053. * @param $fee
  1054. * @return bool
  1055. */
  1056. protected function bookOrderOrChapterOrder($book_info, $chapter_id, $fee, $chapter_name, $is_remind)
  1057. {
  1058. if ($book_info['charge_type'] == 'BOOK') {
  1059. $data = [
  1060. 'uid' => $this->uid,
  1061. 'fee' => $fee,
  1062. 'u' => Cookie::get('send_order_id'),
  1063. 'distribution_channel_id' => $this->distribution_channel_id,
  1064. 'bid' => $book_info->bid,
  1065. 'book_name' => $book_info->book_name,
  1066. 'send_order_id' => Cookie::get('send_order_id') ? Cookie::get('send_order_id') : 0,
  1067. ];
  1068. return BookOrderService::addOrderRecodeAndDecrUserBalance($data, $this->uid);
  1069. } else {
  1070. $data = [
  1071. 'uid' => $this->uid,
  1072. 'fee' => $fee,
  1073. 'cid' => $chapter_id,
  1074. 'bid' => $book_info->bid,
  1075. 'distribution_channel_id' => $this->distribution_channel_id,
  1076. 'book_name' => $book_info->book_name,
  1077. 'chapter_name' => $chapter_name,
  1078. 'send_order_id' => Cookie::get('send_order_id') ? Cookie::get('send_order_id') : 0,
  1079. 'is_remind' => $is_remind
  1080. ];
  1081. //print_r($data);
  1082. if ($is_remind) {
  1083. $this->addOrderRemind($book_info->bid);
  1084. }
  1085. return ChapterOrderService::addOrderAndDecrUserBalance($data, $this->uid);
  1086. }
  1087. }
  1088. protected function addOrderRemind($bid)
  1089. {
  1090. if (ChapterReminderService::checkIsNoReminder($this->uid, $bid)) {
  1091. return true;
  1092. } else {
  1093. ChapterReminderService::add($this->uid, $bid);
  1094. return true;
  1095. }
  1096. }
  1097. /**
  1098. * 是否订购提醒
  1099. * @param $chapter_id
  1100. * @return bool
  1101. */
  1102. protected function isOrderRemind($bid)
  1103. {
  1104. $is_no_reminder = ChapterReminderService::checkIsNoReminder($this->uid, $bid) ? 1 : 0;
  1105. return $is_no_reminder == 0;
  1106. }
  1107. /**
  1108. * 用户是否关注
  1109. * @param $uid
  1110. * @return bool
  1111. */
  1112. protected function getSubscribe()
  1113. {
  1114. $send_order_info = null;
  1115. if(!$this->send_order_id && Redis::hget('channel:setting:'.$this->distribution_channel_id,'no_send_order_subscribe')){
  1116. return true;
  1117. }
  1118. if($this->send_order_id){
  1119. $send_order_info = SendOrderService::getById($this->send_order_id);
  1120. }
  1121. $send_order_subscribe_status = Redis::hget('channel:setting:'.$this->distribution_channel_id,'send_order_subscribe');
  1122. /*if(is_null($send_order_subsribe_status)){
  1123. $send_order_subsribe_status = 0;
  1124. }*/
  1125. //$send_order_subscribe_status = 0;
  1126. if($send_order_subscribe_status &&
  1127. $send_order_info &&
  1128. $send_order_info->promotion_type == 'EXTERNAL' &&
  1129. $send_order_info->send_time &&
  1130. strtotime($send_order_info->send_time) >= 1557712800
  1131. ){
  1132. $subscribe_info = ForceSubscribeUserIService::subscribes($this->uid,$this->distribution_channel_id,$this->send_order_id);
  1133. $this->need_subscribe_appid = $subscribe_info['appid'];
  1134. $this->need_subscribe_name = $subscribe_info['name'];
  1135. return $subscribe_info['is_subscribed'];
  1136. }
  1137. if($send_order_info &&
  1138. $send_order_info->promotion_type == 'INTERNAL' &&
  1139. strtotime($send_order_info->created_at) > 1555488000){
  1140. return true;
  1141. }
  1142. $res = ForceSubscribeService::forceSubscribeUsersByUid(['uid' => $this->uid]);
  1143. if ($res) {
  1144. $this->force_subscribe_time = isset($res->created_at)?$res->created_at:null;
  1145. return true;
  1146. }
  1147. return false;
  1148. }
  1149. /**
  1150. * 获取公众号信息
  1151. * @param $distribution_channel_id
  1152. */
  1153. protected function getOfficialAccount()
  1154. {
  1155. $distribution_channel_id = $this->distribution_channel_id;
  1156. $res = OfficialAccountService::canUseOfficialAccountByChannelId(compact('distribution_channel_id'));
  1157. if (isset($res->nickname) && !empty($res->nickname)) {
  1158. Cookie::queue('force_subscribe_name', $res->nickname, env('U_COOKIE_EXPIRE'));
  1159. }
  1160. return $res;
  1161. }
  1162. /**
  1163. * 获取二维码
  1164. * @param $param
  1165. * @return bool
  1166. */
  1167. private function getRcodeInfo($param, $bid)
  1168. {
  1169. //return "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQGI8DwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyZEZ0T0ZoSHljM2kxOTUwQU5zY08AAgRF8-xbAwQAjScA";
  1170. $param_need = [
  1171. 'gzh_app_id' => $param['appid'],
  1172. 'scene_id' => $this->uid,
  1173. 'timestamp' => time(),
  1174. ];
  1175. $param_need['sign'] = $this->getSign($param_need);
  1176. $client = new Client(['timeout' => 3.0,]);
  1177. try {
  1178. Log::info('get qrcode url is:' . 'https://zsyauth.aizhuishu.com/api/get_qrcode_url?' . http_build_query($param_need));
  1179. $qrcode_url_res = $client->request('get', 'https://zsyauth.aizhuishu.com/api/get_qrcode_url?' . http_build_query($param_need))->getBody()->getContents();
  1180. if ($qrcode_url_res) {
  1181. $qrcode_url = json_decode($qrcode_url_res, true);
  1182. if ($qrcode_url['code'] == 1) {
  1183. //保存强关时的bid
  1184. if (isset($qrcode_url['data']) && !empty($qrcode_url['data'])) {
  1185. Redis::hset('force_subscribe_from_bid', $param['appid'] . '_' . $this->uid, $bid);
  1186. $send_order_id = Cookie::get('send_order_id') ? Cookie::get('send_order_id') : 0;
  1187. Redis::hset('force_subscribe_from_send_order_id', $param['appid'] . '_' . $this->uid, $send_order_id);
  1188. Log::info('uid is' . $this->uid . '--qrcode is:' . $qrcode_url['data']);
  1189. return $qrcode_url['data'];
  1190. }
  1191. }
  1192. }
  1193. } catch (\Exception $e) {
  1194. //\Log::info($e);
  1195. //Redis::sadd('force_subscribe_qrcode:error', $param['appid'] . '_' . time());
  1196. }
  1197. return false;
  1198. }
  1199. /**
  1200. * 获取订购记录
  1201. * @param $book_info
  1202. * @param $chapter_id
  1203. * @return bool
  1204. */
  1205. private function getOrderRecord($bid, $chapter_id)
  1206. {
  1207. //包年记录
  1208. $uid = $this->uid;
  1209. $res = YearOrderService::getRecord($uid);
  1210. if ($res) return true;
  1211. $res = null;
  1212. //单本订购记录
  1213. $res = BookOrderService::getRecordByuidBid($uid, $bid);
  1214. if ($res) return true;
  1215. $res = null;
  1216. //章节订购记录
  1217. $chapterOrder = new ChapterOrderService();
  1218. if ($chapterOrder->checkIsOrdered($uid, $bid, $chapter_id)) return true;
  1219. return false;
  1220. }
  1221. /**
  1222. * 计算价格
  1223. * @param $book_info
  1224. * @param $chapter_size
  1225. * @return float
  1226. */
  1227. private function getPrice($book_info, $chapter)
  1228. {
  1229. if ($book_info->charge_type == 'BOOK') {
  1230. if(BookOrderService::isHasBookOrder($this->uid)){
  1231. $this->is_first_book_order = 0;
  1232. return 1399;
  1233. }else{
  1234. $this->is_first_book_order = 1;
  1235. return 899;
  1236. }
  1237. } else {
  1238. //$fee = ceil($chapter->size/100);
  1239. //$channel_fee = BookService::getChapterPrice()
  1240. $channel_fee = BookService::getChapterPrice($this->distribution_channel_id);
  1241. if ($channel_fee) {
  1242. $price_rate = $channel_fee / 100;
  1243. } else {
  1244. //$price_rate = 0.012;
  1245. $price_rate = env('DEFAULT_CHAPTER_PRICE', 0.015);
  1246. }
  1247. //Log::info($price_rate);
  1248. $fee = ceil($chapter->size * $price_rate);
  1249. /*if($this->isRaisePrice()){
  1250. $fee = round($chapter->size * 0.018);
  1251. }*/
  1252. }
  1253. /*//首个计费章节书币价格以35书币为基准,低于35提升至35,原价高于35书币,维持原价
  1254. if (isset($chapter->sequence) && isset($book_info->vip_seq)) {
  1255. if ($chapter->sequence == $book_info->vip_seq) {
  1256. if ($fee < 35) {
  1257. $fee = 35;
  1258. }
  1259. }
  1260. }
  1261. //$template_10_site = redisEnv('TEMPLATE_10_SITE','');
  1262. list($template_10_site,$template_10_no_abtest_site) = redisEnvMulti('TEMPLATE_10_SITE','TEMPLATE_10_NO_AB_TEST_SITE');
  1263. $start_time = env('TEMPLATE_COMPARE_START_TIME', 0);
  1264. if($start_time && $template_10_site && in_array($this->distribution_channel_id,explode(',',$template_10_site))){
  1265. if($this->uid %2 == 0 && strtotime($this->user->created_at) > $start_time){
  1266. if($fee <37) $fee = 37;
  1267. if($fee >45) $fee = 45;
  1268. }
  1269. }
  1270. if($template_10_no_abtest_site &&
  1271. in_array($this->distribution_channel_id,explode(',',$template_10_no_abtest_site)) &&
  1272. ($info = DataAnalysisSelectUserService::getByUidAndType($this->uid, 'TEMPLATE_COMPAREV10_2')) &&
  1273. $info->attach
  1274. ){
  1275. if($fee <37) $fee = 37;
  1276. if($fee >45) $fee = 45;
  1277. }*/
  1278. if($fee <37) $fee = 37;
  1279. if($fee >60) $fee = 60;
  1280. return $fee;
  1281. }
  1282. //降低付费用户书币价值
  1283. private function isRaisePrice(){
  1284. if(!$this->uid)
  1285. return false;
  1286. if(!$this->user)
  1287. return false;
  1288. if($this->user->balance < 100){
  1289. return false;
  1290. }
  1291. if(!in_array($this->distribution_channel_id,[211,123])){
  1292. return false;
  1293. }
  1294. if(DataAnalysisSelectUserService::getByUidAndType($this->uid,'RAISE')){
  1295. return true;
  1296. }
  1297. return false;
  1298. }
  1299. /**
  1300. * 获取强关章节数
  1301. * @param $book
  1302. * @return int
  1303. */
  1304. private function getSubscribeChapterNum($book)
  1305. {
  1306. $hour = date('G');
  1307. $send_order_info = null;
  1308. if(in_array($this->distribution_channel_id,[123,211]) && $this->send_order_id){
  1309. //开启落地页强关的需求有变,需要在链接实际推广1小时后就开启功能
  1310. $send_order_info = SendOrderService::getById($this->send_order_id);
  1311. if($send_order_info && $send_order_info->send_time && time()-strtotime($send_order_info->send_time) > 3600){
  1312. return 1;
  1313. }
  1314. }
  1315. if($this->send_order_id && $hour <=5 && in_array($this->send_order_id,[392216,392218,415200,415212,415163])){
  1316. return 1;
  1317. }
  1318. if($this->send_order_id && $hour <=5 && time()>1552233600 && in_array($this->send_order_id,[424454,424453,424452,424451,424450,424449,424448,424447,424446,424445,424444,424443,424442,424441,424440,424439,424438,424437,424436,424435,424434,424433,424432,424431,424430])){
  1319. return 1;
  1320. }
  1321. //派单强关
  1322. if ($this->send_order_id) {
  1323. $send_order_info || $send_order_info = SendOrderService::getById($this->send_order_id);
  1324. if ($send_order_info && $send_order_info->book_id == $book->bid && $send_order_info->subscribe_chapter_seq) {
  1325. return $send_order_info->subscribe_chapter_seq;
  1326. }
  1327. }
  1328. $subscribe = BookSubscribleChapterService::getSubcribleChapter($book->bid, $this->distribution_channel_id);
  1329. if ($subscribe) {
  1330. return (isset($subscribe->subscribe_chapter_id) && $subscribe->subscribe_chapter_id > 0) ? $subscribe->subscribe_chapter_id : $book->force_subscribe_chapter_seq;
  1331. }
  1332. return $book->force_subscribe_chapter_seq;
  1333. }
  1334. /**
  1335. * 判断访问的域名和数据库指定的域名是否一致,一致返回false ,不一致 true
  1336. * @param $domain 当前访问的doain
  1337. * @return bool
  1338. */
  1339. private function isVisitDomainNotEqualBookDomain($domain, $check_seq, $is_forced=false)
  1340. {
  1341. if($this->chapter->sequence <= $check_seq) return false;//判断check章节序号
  1342. $book_domain = $this->book_info->promotion_domain;
  1343. if(!$is_forced)
  1344. {
  1345. if ($domain == 'zhuishuyun' && stripos($book_domain, 'leyuee') !== false) {
  1346. return false;
  1347. }
  1348. }
  1349. return stripos($book_domain, $domain) === false;
  1350. }
  1351. //获取对当前图书对应域名的链接
  1352. private function getCorrespondBookUrl()
  1353. {
  1354. $url = sprintf(
  1355. 'https://site%s.%s/reader?bid=%s&cid=%s&send_order_id=%s&fromtype=%s&stats=2&crm=%s',
  1356. $this->en_distribution_channel_id,
  1357. $this->book_info->promotion_domain,
  1358. $this->en_bid,
  1359. $this->cid,
  1360. $this->send_order_id,
  1361. $this->from_type,
  1362. $this->crm
  1363. );
  1364. return $url;
  1365. }
  1366. /**
  1367. * 用户添加标签
  1368. * @param $book_info
  1369. */
  1370. private function addTag($book_info)
  1371. {
  1372. if (!UserDeepReadTagService::isAddTag($this->uid, $book_info->bid)) {
  1373. try {
  1374. UserDeepReadTagService::addTag([
  1375. 'uid' => $this->uid,
  1376. 'bid' => $book_info->bid,
  1377. 'book_name' => $book_info->book_name,
  1378. 'category_id' => $book_info->category_id,
  1379. 'category_name' => $book_info->category_name,
  1380. 'sex_preference' => $book_info->channel_name ? $book_info->channel_name : '',
  1381. 'distribution_channel_id' => $this->distribution_channel_id ? $this->distribution_channel_id : '0',
  1382. 'send_order_id' => Cookie::get('send_order_id') ? Cookie::get('send_order_id') : 0,
  1383. ]);
  1384. } catch (\Exception $e) {
  1385. }
  1386. }
  1387. }
  1388. private function newUserRewardRead()
  1389. {
  1390. $count = ChapterOrderService::getUserRecordCount($this->uid);
  1391. return $count > 2;
  1392. }
  1393. private function isBookOrdered($bid)
  1394. {
  1395. $chapter_order = ChapterOrderService::checkBookIsOrdered($this->uid, $bid);
  1396. if ($chapter_order) return true;
  1397. $res = BookOrderService::getRecordByuidBid($this->uid, $bid);
  1398. if ($res) return true;
  1399. return false;
  1400. }
  1401. private function beforeForceSubAndBeforeVipUvAndPv($book, $book_force_seq, $chapter)
  1402. {
  1403. $send_order_id = Cookie::get('send_order_id') ? Cookie::get('send_order_id') : 14;
  1404. $prev_sub_seq = 0;
  1405. if ($book_force_seq) {
  1406. $prev_sub_seq = $book_force_seq - 1;
  1407. }
  1408. $prev_vip_seq = 0;
  1409. $date = date('Y-m-d');
  1410. if (isset($book->vip_seq) && !empty($book->vip_seq)) {
  1411. $prev_vip_seq = $book->vip_seq - 1;
  1412. }
  1413. if ($chapter->sequence == $prev_vip_seq) {
  1414. $uv_key = 'book:' . $book->bid . ':beforevip:uv:date:' . $date . ':send_order_id:' . $send_order_id;
  1415. $pv_key = 'book:' . $book->bid . ':beforevip:pv:send_order_id:' . $send_order_id;
  1416. Redis::hincrby($pv_key, $date, 1);
  1417. Redis::hincrby($pv_key, 'total', 1);
  1418. Redis::sadd($uv_key, $this->uid);
  1419. Redis::sadd('beforevip' . $date, $book->bid . '-' . $send_order_id);
  1420. }
  1421. if ($chapter->sequence == $prev_sub_seq) {
  1422. $uv_key = 'book:' . $book->bid . ':beforeforcesub:uv:date:' . $date . ':send_order_id:' . $send_order_id;
  1423. $pv_key = 'book:' . $book->bid . ':beforeforcesub::pvsend_order_id:' . $send_order_id;
  1424. Redis::hincrby($pv_key, $date, 1);
  1425. Redis::hincrby($pv_key, 'total', 1);
  1426. Redis::sadd($uv_key, $this->uid);
  1427. Redis::sadd('beforeforcesub' . $date, $book->bid . '-' . $send_order_id);
  1428. }
  1429. }
  1430. private function readRecordOther()
  1431. {
  1432. $bid = $this->book_info->bid;
  1433. $cid = $this->cid;
  1434. $distribution_channel_id = $this->distribution_channel_id;
  1435. $send_order_id = $this->send_order_id;
  1436. $from = $this->from_type;
  1437. $sequence = $this->chapter->sequence;
  1438. ReadRecordStatsService::record($this->uid,$bid,$cid,$distribution_channel_id,$send_order_id,$from,$sequence);
  1439. /*$chapter = $this->chapter;
  1440. try {
  1441. $data = [];
  1442. $data['uid'] = $this->uid;
  1443. $data['bid'] = $chapter->bid;
  1444. $data['cid'] = $chapter->id;
  1445. $data['is_vip'] = $chapter->is_vip;
  1446. $data['seq'] = $chapter->sequence;
  1447. $data['created_at'] = date('Y-m-d H:i:s');
  1448. $data['updated_at'] = date('Y-m-d H:i:s');
  1449. DB::table('read_records')->insert($data);
  1450. } catch (\Exception $e) {
  1451. }*/
  1452. }
  1453. /**
  1454. * 下架图书 true:下架不能阅读了, false:可以正常阅读
  1455. * @return bool
  1456. */
  1457. private function isOffShelf()
  1458. {
  1459. $book_info = $this->book_info;
  1460. //针对米玩站点部分图书放开
  1461. $miwan_sites = [4340,4834,4842,4992,5014,5021,5030,5035,5036,5037,5042,5043,5048,5049,5051,5066,5075,5094,5095,5096,5106,5110,5111,5112,5122,5131,5157,5167,5180,5189,5232,5234,5237,5238,5240];
  1462. if(in_array($this->distribution_channel_id,$miwan_sites) && in_array($book_info->bid,[1154,1232,1276,1295,1535,1542,1629,2430,4437,4730]))
  1463. {
  1464. return false;
  1465. }
  1466. if ($book_info->is_on_shelf == 0 || $book_info->is_on_shelf == 3) {
  1467. return true;
  1468. }
  1469. //屏蔽一本书1042 2626
  1470. if (in_array($book_info->bid, [1042, 2626]) && $this->distribution_channel_id == 123) {
  1471. return true;
  1472. }
  1473. if ($book_info->is_on_shelf == 4) {
  1474. //版权到期,有阅读记录还可以继续阅读,订购
  1475. /*if (!ReadRecordService::getRecordByUidBid($this->uid, $book_info->bid)) {
  1476. return true;
  1477. }*/
  1478. //版权到期,有包年可以继续阅读
  1479. $year_order = YearOrderService::getRecord($this->uid);
  1480. if($year_order){
  1481. return false;
  1482. }
  1483. //1155
  1484. //版权到期,有订购记录还可以继续阅读,订购
  1485. $chapter_order = ChapterOrderService::checkBookIsOrdered($this->uid, $book_info->bid);
  1486. if (!$chapter_order) return true;
  1487. if($book_info->bid == 1155){
  1488. $charge_info = Order::where('uid',$this->uid)
  1489. ->where('price','>=',redisEnv('OFF_SHELF_BOOK_LIMIT_CHARGE',0))
  1490. ->where('from_bid',$book_info->bid)
  1491. ->where('status','PAID')
  1492. ->first();
  1493. if(!$charge_info){
  1494. return true;
  1495. }
  1496. }
  1497. }
  1498. if($book_info->is_on_shelf == 10){
  1499. //Log::info('ddddddddddddddddddddddddddd');
  1500. $yq_book_user = BookUserService::selectUser($this->uid);
  1501. //Log::info($yq_book_user);
  1502. if($yq_book_user && $yq_book_user->type == 'ENABLE'){
  1503. return false;
  1504. }
  1505. return true;
  1506. }
  1507. //crm上架
  1508. if($book_info->is_on_shelf == 5){
  1509. if(!CrmUserService::isCrmUser($this->uid,$this->is_paid)){
  1510. return true;
  1511. }
  1512. }
  1513. return false;
  1514. }
  1515. //章节被删除的情况
  1516. private function chapterNotExists()
  1517. {
  1518. $chapter = $this->chapter;
  1519. $cid = $this->cid;
  1520. if ($chapter) return false;
  1521. //章节不存在的情况
  1522. $no_check = ChapterService::getChapterNameByIdNoCheck($cid);
  1523. $h5_scheme = 'https';
  1524. if (!$no_check) {
  1525. //章节真正不存在的情况
  1526. $url = $h5_scheme . '://' . _domain() . '/catalog?id=' . $this->en_bid;
  1527. return $url;
  1528. }
  1529. //章节被删除的情况
  1530. // if ($no_check->next_cid) {
  1531. // $url = $h5_scheme . '://' . _domain() . '/reader?bid=' . $this->en_bid . '&cid=' . $no_check->next_cid;
  1532. // return $url;
  1533. // }
  1534. //章节被删除的是最后一章的情况
  1535. $url = $h5_scheme . '://' . _domain() . '/catalog?id=' . $this->en_bid;// . '&sequence=' . $no_check->sequence;
  1536. return $url;
  1537. }
  1538. /**
  1539. * 深度阅读
  1540. * @param $chapter
  1541. */
  1542. private function deepReadRecord()
  1543. {
  1544. if (!env('ON_BOOK_UV_PV', false)) {
  1545. return;
  1546. }
  1547. $chapter = $this->chapter;
  1548. $key = 'book:' . $chapter->bid . ':deepread:uv';
  1549. $chapter_key = 'book:' . $chapter->bid . ':chapterseq:' . $chapter->sequence;
  1550. if (Redis::scard($key) > 50000) {
  1551. if (Redis::Sismember($key, $this->uid)) {
  1552. Redis::sadd($chapter_key, $this->uid);
  1553. }
  1554. } else {
  1555. Redis::sadd($key, $this->uid);
  1556. Redis::sadd($chapter_key, $this->uid);
  1557. }
  1558. }
  1559. /**
  1560. * 强关类型
  1561. * @param $appid
  1562. * @return array
  1563. */
  1564. private function getSubscribeType($appid, $bid)
  1565. {
  1566. $send_order_id = Cookie::get('send_order_id') ? Cookie::get('send_order_id') : 0;
  1567. $sub_setting = ChannelSubscribeSettingService::getSubscribeTypeByAppId($appid);
  1568. if (!$sub_setting) return ['type' => [1], 'url' => ''];
  1569. $types = explode(',', $sub_setting->force_subscribe_type);
  1570. $url = '';
  1571. if (in_array(3, $types) && !empty($sub_setting->resource_url)) {
  1572. $h5_scheme = env('H5_SCHEME', 'https');
  1573. $url = $h5_scheme . '://' . _domain() . '/subscribeauth/?uid=' . $this->uid . '&distribution_channel_id=' . $this->distribution_channel_id . '&appid=' . $appid . '&bid=' . $bid . '&send_order_id=' . $send_order_id;
  1574. }
  1575. return ['type' => $types, 'url' => $url];
  1576. }
  1577. private function showChapterPrice($bid, $charge_type)
  1578. {
  1579. if ($charge_type == 'BOOK') {
  1580. return false;
  1581. }
  1582. $show_chapter_price_bid = env('SHOW_CHAPTER_PRICE_BID', 'all');
  1583. if ($show_chapter_price_bid != 'all') {
  1584. $show_chapter_price_bid_array = explode(',', $show_chapter_price_bid);
  1585. if (!in_array($bid, $show_chapter_price_bid_array)) {
  1586. return false;
  1587. }
  1588. }
  1589. $show_chapter_price_channel = env('SHOW_CHAPTER_PRICE_CHANNEL', '');
  1590. if (!$show_chapter_price_channel) {
  1591. return false;
  1592. }
  1593. if ($show_chapter_price_channel == 'all') {
  1594. return true;
  1595. }
  1596. $show_chapter_price_channel_array = explode(',', $show_chapter_price_channel);
  1597. if (in_array($this->distribution_channel_id, $show_chapter_price_channel_array)) {
  1598. return true;
  1599. }
  1600. return false;
  1601. }
  1602. /**
  1603. * 阅读统计
  1604. */
  1605. private function chapterStats()
  1606. {
  1607. $chapter = $this->chapter;
  1608. $bid = $this->book_info->bid;
  1609. //派单精确统计
  1610. if ($chapter->sequence <= 30) {
  1611. //$this->sendOrderChapterUv($bid, $chapter->sequence);
  1612. }
  1613. //智能推送 测书统计章节uv
  1614. if ($chapter->sequence <= 60) {
  1615. //测书数据 由30改到60 2018-11-26 18:00
  1616. if($this->book_info->test_status == 1){
  1617. $this->smartPushTestBookChapterUv($bid, $chapter->sequence); //2019-07-09 10:30 cancel
  1618. }
  1619. }
  1620. //智能推送 测书统计第二章 uv
  1621. if ($chapter->sequence == 2) {
  1622. $this->smartPushTestBookSecondChapterUv($bid);
  1623. }
  1624. // 统计前5张uv 会放在book_five_chapter_uv表中,脚本在 \App\Console\Commands\BookTest::data1里面
  1625. // 作用早忘记了
  1626. $field = date('Y-m-d');
  1627. /*
  1628. if ($chapter->sequence <= 5 && $this->send_order_id) {
  1629. try {
  1630. Redis::sadd(sprintf('book_before_five_uv_%s_%s_%s', $field, $bid, $chapter->sequence), $this->uid);
  1631. Redis::sadd('book_before_five_uvs', sprintf('%s_%s_%s', $field, $bid, $chapter->sequence));
  1632. } catch (\Exception $e) {
  1633. }
  1634. }*/
  1635. //统计点击率
  1636. $key = 'book_click_num_bid_' . $bid;
  1637. try {
  1638. Redis::HINCRBY($key, $field, 1);
  1639. } catch (\Exception $e) {
  1640. }
  1641. //阅读页面pvuv
  1642. $this->recordReaderUvAndPv();
  1643. }
  1644. private function smartPushTestBook($bid, $balance)
  1645. {
  1646. $smart_bid = ReadRecordService::getSmartPush($this->uid);
  1647. if ($smart_bid && in_array($bid, $smart_bid)) {
  1648. $field = sprintf('%s_amount', $bid);
  1649. try {
  1650. Redis::HINCRBY('smart_push_test_book', $field, $balance);
  1651. Redis::sadd('smart_push_test_book_user_count' . $bid, $this->uid);
  1652. } catch (\Exception $e) {
  1653. }
  1654. }
  1655. }
  1656. private function smartPushTestBookSecondChapterUv($bid)
  1657. {
  1658. $smart_bid = ReadRecordService::getSmartPush($this->uid);
  1659. if ($smart_bid && in_array($bid, $smart_bid)) {
  1660. try {
  1661. Redis::sadd('smart_push_test_book_second_uv' . $bid, $this->uid);
  1662. } catch (\Exception $e) {
  1663. }
  1664. }
  1665. }
  1666. private function smartPushTestBookChapterUv($bid, $sequence)
  1667. {
  1668. $smart_bid = ReadRecordService::getSmartPush($this->uid);
  1669. if ($smart_bid && in_array($bid, $smart_bid)) {
  1670. try {
  1671. $key = 'smartPushTestBookChapterUv:bid:%s:seq:%s';
  1672. Redis::sadd(sprintf($key, $bid, $sequence), $this->uid);
  1673. } catch (\Exception $e) {
  1674. }
  1675. }
  1676. }
  1677. /**
  1678. * 测书 智能推送统计
  1679. * @param $bid
  1680. */
  1681. private function smartPushTestBookPayPageUv($bid)
  1682. {
  1683. $smart_bid = ReadRecordService::getSmartPush($this->uid);
  1684. if ($smart_bid && in_array($bid, $smart_bid)) {
  1685. try {
  1686. $key = 'smartPushTestBookPayPageUv:bid:%s';
  1687. Redis::sadd(sprintf($key, $bid), $this->uid);
  1688. } catch (\Exception $e) {
  1689. }
  1690. }
  1691. }
  1692. /**
  1693. * 派单精确统计--章节
  1694. * @param $bid
  1695. * @param $sequence
  1696. */
  1697. private function sendOrderChapterUv($bid, $sequence)
  1698. {
  1699. if ($this->send_order_id) {
  1700. $send_order_bid = Redis::hget('sendOrderIdToBid', $this->send_order_id);
  1701. if (!$send_order_bid) {
  1702. $send_order_info = SendOrderService::getById($this->send_order_id);
  1703. if ($send_order_info) {
  1704. $send_order_bid = $send_order_info->book_id;
  1705. Redis::hset('sendOrderIdToBid', $this->send_order_id, $send_order_bid . '-' . time());
  1706. }
  1707. } else {
  1708. $send_order_bid_arr = explode('-', $send_order_bid);
  1709. $send_order_bid = $send_order_bid_arr[0];
  1710. }
  1711. if ($send_order_bid && $send_order_bid == $bid) {
  1712. try {
  1713. $key = 'accurateSendOrderChapterUv:bid:%s:seq:%s:sendorderid:' . $this->send_order_id;
  1714. Redis::sadd(sprintf($key, $bid, $sequence), $this->uid);
  1715. } catch (\Exception $e) {
  1716. }
  1717. }
  1718. }
  1719. }
  1720. /**
  1721. * 派单精确统计--强关页面uv
  1722. * @param $bid
  1723. */
  1724. private function sendOrderSubscribePageUv($bid)
  1725. {
  1726. if ($this->send_order_id) {
  1727. $send_order_bid = Redis::hget('sendOrderIdToBid', $this->send_order_id);
  1728. if (!$send_order_bid) {
  1729. $send_order_info = SendOrderService::getById($this->send_order_id);
  1730. if ($send_order_info) {
  1731. $send_order_bid = $send_order_info->book_id;
  1732. Redis::hset('sendOrderIdToBid', $this->send_order_id, $send_order_bid . '-' . time());
  1733. }
  1734. } else {
  1735. $send_order_bid_arr = explode('-', $send_order_bid);
  1736. $send_order_bid = $send_order_bid_arr[0];
  1737. }
  1738. if ($send_order_bid && $send_order_bid == $bid) {
  1739. try {
  1740. $key = 'accurateSendOrderSubscribePageUv:bid:%s:sendorderid:' . $this->send_order_id;
  1741. Redis::sadd(sprintf($key, $bid), $this->uid);
  1742. } catch (\Exception $e) {
  1743. }
  1744. }
  1745. }
  1746. }
  1747. /**
  1748. * 派单精确统计--支付页面uv
  1749. * @param $bid
  1750. */
  1751. private function sendOrderPayPageUv($bid)
  1752. {
  1753. if ($this->send_order_id) {
  1754. $send_order_bid = Redis::hget('sendOrderIdToBid', $this->send_order_id);
  1755. if (!$send_order_bid) {
  1756. $send_order_info = SendOrderService::getById($this->send_order_id);
  1757. if ($send_order_info) {
  1758. $send_order_bid = $send_order_info->book_id;
  1759. Redis::hset('sendOrderIdToBid', $this->send_order_id, $send_order_bid . '-' . time());
  1760. }
  1761. } else {
  1762. $send_order_bid_arr = explode('-', $send_order_bid);
  1763. $send_order_bid = $send_order_bid_arr[0];
  1764. }
  1765. if ($send_order_bid && $send_order_bid == $bid) {
  1766. try {
  1767. $key = 'accurateSendOrderPayPageUv:bid:%s:send_order_id:' . $this->send_order_id;
  1768. Redis::sadd(sprintf($key, $bid), $this->uid);
  1769. } catch (\Exception $e) {
  1770. }
  1771. }
  1772. }
  1773. }
  1774. private function recordReaderUvAndPv()
  1775. {
  1776. WapVisitStatService::recordReaderUvAndPv($this->uid, $this->distribution_channel_id);
  1777. }
  1778. //用户是否在广告样本中
  1779. private function isUserInAdSample(){
  1780. /*$res = DataAnalysisSelectUserService::getByUidAndType($this->uid,'AD_V2');
  1781. if($res){
  1782. return true;
  1783. }else{
  1784. return false;
  1785. }*/
  1786. $is_ad_user = Cookie::get('cpc_ad_status');
  1787. if($is_ad_user && $is_ad_user == 'show') return true;
  1788. return false;
  1789. }
  1790. //阅读页面底部是否显示广告
  1791. private function isShowAd(){
  1792. if (in_array($this->uid, explode(',', env('TEST_CPC_UID')))) {
  1793. $this->chapter->is_visiable_ad = 1;
  1794. if($this->chapter->is_vip){
  1795. $this->chapter->is_show_ad = 1;
  1796. }
  1797. return ;
  1798. }
  1799. $ad_status = env('AD_STATUS',1);
  1800. if(!$ad_status){
  1801. return ;
  1802. }
  1803. if(!$this->is_had_subscribe){
  1804. return ;
  1805. }
  1806. //if(!in_array($this->distribution_channel_id,[2,5,8,14,123,146,148,155,160,196,202,211,255,256,266,271,273,318,691,695,722,4025,4053,4174,4236,4237,4241,4334,4364,4426,4427,4487,4488,4593,4742,4889,4891,5204])){
  1807. $cpc_status = Redis::hget('channel:setting:'.$this->distribution_channel_id,'cpc_status');
  1808. if($cpc_status === '0'){
  1809. return ;
  1810. }
  1811. //按章付费才显示
  1812. if($this->book_info->charge_type != 'CHAPTER'){
  1813. return ;
  1814. }
  1815. //用户是否在广告样本中
  1816. //if(!$this->isUserInAdSample()) return ;
  1817. $is_ad_user = Cookie::get('cpc_ad_status');
  1818. if(!$is_ad_user || $is_ad_user != 'show') return ;
  1819. $cid = 0;
  1820. if($this->chapter && $this->chapter->next_cid){
  1821. $cid = $this->chapter->next_cid;
  1822. }
  1823. if(!$cid){
  1824. return ;
  1825. }
  1826. //付费用户没有广告
  1827. if(OrderService::isPaidUser($this->uid)) return ;
  1828. //如果下一张已经付费,广告不显示
  1829. /*$exists = AdVisitStatService::getByUid($this->uid);
  1830. if(!$exists){
  1831. if($this->uid %2 == 0){
  1832. DataAnalysisSelectUserService::create($this->uid,$this->distribution_channel_id,'AD_TEST_3',-1,'unshow');
  1833. return ;
  1834. }else{
  1835. DataAnalysisSelectUserService::create($this->uid,$this->distribution_channel_id,'AD_TEST_3',-1,'show');
  1836. }
  1837. }*/
  1838. //广告都显示
  1839. $this->chapter->is_visiable_ad = 1;
  1840. AdVisitStatService::create($this->uid,$this->book_info->bid,$this->cid,'EXPOSURE');
  1841. if($this->getOrderRecord($this->book_info->bid, $cid)){
  1842. return ;
  1843. }
  1844. $next_chapter = ChapterService::getChapterNameById($cid, $this->book_info->bid);
  1845. //下一章事vip的话 才显示广告
  1846. if(!$next_chapter || !$next_chapter->is_vip){
  1847. return ;
  1848. }
  1849. $price = $this->getPrice($this->book_info,$next_chapter);
  1850. $flag = $price > $this->user->balance;
  1851. if( $flag ){
  1852. $this->chapter->is_show_ad = 1;
  1853. AdVisitStatService::create($this->uid,$this->book_info->bid,$this->cid,'CAN_CLICK');
  1854. }
  1855. }
  1856. private function crmChapterStats($fee){
  1857. $crm = Cookie::get('crm');
  1858. if(!$crm)return ;
  1859. try{
  1860. CrmChapterOrderDetailService::create($this->uid,$fee,$this->book_info->bid,$crm);
  1861. }catch (\Exception $e){}
  1862. }
  1863. private function customChapterOrderStats($fee)
  1864. {
  1865. //custom_290824
  1866. Log::info('customChapterOrderStats start');
  1867. Log::info($this->from_type);
  1868. if(strpos($this->from_type,'custom') === false){
  1869. return ;
  1870. }
  1871. $customer_id= str_ireplace('custom_','',$this->from_type);
  1872. Log::info($customer_id);
  1873. if(!$customer_id || !is_numeric($customer_id)) return ;
  1874. $info = Redis::hget('latestcustomerinfo',$customer_id);
  1875. if(!$info) return ;
  1876. Log::info($info);
  1877. $info_array = json_decode($info,1);
  1878. Log::info($info_array);
  1879. $customer_bid = isset($info_array['bid'])?$info_array['bid']:0;
  1880. $customer_send_time = isset($info_array['send_time'])?$info_array['send_time']:0;
  1881. if(!$customer_bid || !$customer_send_time) return ;
  1882. CustomChapterOrderService::create([
  1883. 'distribution_channel_id'=>$this->distribution_channel_id,
  1884. 'bid'=>$this->book_info->bid,
  1885. 'cid'=>$this->cid,
  1886. 'book_name'=>$this->book_info->book_name,
  1887. 'chapter_name'=>$this->chapter->name,
  1888. 'uid'=>$this->uid,
  1889. 'send_order_id'=>$this->send_order_id,
  1890. 'fee'=>$fee,
  1891. 'charge_balance'=>0,
  1892. 'reward_balance'=>0,
  1893. 'custom_id'=>$customer_id,
  1894. 'flag'=>$customer_bid == $this->book_info->bid?1:0,
  1895. 'send_time'=>$customer_send_time
  1896. ]);
  1897. }
  1898. private function forceGuidePerson(){
  1899. //强制导粉
  1900. //$force_guide_sites = redisEnv('FORCE_GUIDE_SITES');
  1901. //$img = redisEnv('GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE');
  1902. $flag = 1;
  1903. if(Redis::SISMEMBER('crm:out_channel_sites',$this->distribution_channel_id)){
  1904. $img = redisEnv('OUT_FORCE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE');
  1905. $force_guide_sites = $this->distribution_channel_id;
  1906. $group = 'OUT_FORCE';
  1907. $flag = Cookie::get('is_force_out_guide');
  1908. $flag = $flag?$flag:0;
  1909. }else{
  1910. list($force_guide_sites,$img) = redisEnvMulti('GUIDE_PERSONAL_ACCOUNT_SITES','FORCE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE');
  1911. $group = 'FORCE';
  1912. }
  1913. if($flag && $force_guide_sites &&
  1914. $img &&
  1915. in_array($this->distribution_channel_id,explode(',',$force_guide_sites)) &&
  1916. $this->is_paid &&
  1917. ($this->chapter->sequence == 2 || $this->chapter->sequence == 8)&&
  1918. !UserBindHkWelfareService::isHasGet($this->uid) &&
  1919. ForceGuidePersonAccountService::isShow($this->uid,$this->book_info->bid,$this->cid)
  1920. ){
  1921. return sprintf('/force/guide?bid=%s&cid=%s&book_name=%s&prev_cid=%s',$this->en_bid,$this->cid,$this->book_info->book_name,$this->chapter->prev_cid);
  1922. }
  1923. return '';
  1924. }
  1925. public function getWechatJsConfig(Request $request)
  1926. {
  1927. //try {
  1928. // $chapter->is_show_share_button = 1;
  1929. $bid = $request->input('bid', '');
  1930. $cid = $request->input('cid', '');
  1931. $url = $request->input('url', '');
  1932. $url = urldecode($url);
  1933. \Log::info('url:' . ($this->uid) . $url);
  1934. if (empty($bid) || empty($cid) || empty($url)) {
  1935. return response()->error('PARAM_EMPTY');
  1936. }
  1937. $share_url = 'https://'._domain().'/detail?fromtype=readershare&id='.$bid.'&fromflag='.($this->uid).'&fromcid='.$cid;
  1938. //$js_config = ChapterShareWechatConfigService::getConfig($url);
  1939. $app_hash = array(
  1940. 4025=>['appid'=>'wx80b618c9dcc940f7','appsecret'=>'255a2de8db51e4084b5e9087d26d4ecb'],
  1941. 4147=>['appid'=>'wx2a99699cd9572812','appsecret'=>'0e0d57f94eeba50abb3af6883df05a5c'],
  1942. 691=>['appid'=>'wx5cefcd251dc40693','appsecret'=>'755f64c85173dad21f20870e38f59d8a'],
  1943. 123=>['appid'=>'wx983808610aa9dcc5','appsecret'=>'91002999590b79f3c7be35fd73c04049'],
  1944. 211=>['appid'=>'wx39338e374cc2055b','appsecret'=>'1a4c2039be271b3811182be5bb53eb34'],
  1945. );
  1946. $appId = $app_hash[$this->distribution_channel_id]['appid'];
  1947. $appSecret = $app_hash[$this->distribution_channel_id]['appsecret'];
  1948. $js_config = (new ChapterShareWechatConfigService($appId,$appSecret))->getSignPackage($url);
  1949. /*$appid = DB::table('official_accounts')->where('distribution_channel_id',$this->distribution_channel_id)->first();//(['distribution_channel_id'=>$this->distribution_channel_id]);
  1950. $appid = $appid->appid;
  1951. //\Log::info('get_appid:'.($appid));
  1952. $js_config = (new ChapterShareWechatConfigService($appid))->getSignPackage($url);
  1953. //$chapter->js_config = $js_config;
  1954. //$chapter->share_url = $share_url;
  1955. $book = BookService::getBookById(Hashids::decode($bid)[0]);
  1956. $first_cid = $book->first_cid;
  1957. $share_url = 'https://site' . encodeDistributionChannelId($this->distribution_channel_id) . '.' . env('SHARE_DOMAIN') . '/reader?fromtype=readershare&bid=' . $bid . '&cid=' . ($first_cid) . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
  1958. /*if (in_array($this->uid, explode(',', env('TEST_SHARE_UIDS')))) {
  1959. $share_url = 'https://site5017zqeyzwgyx9n8.zhuishuyun.com/reader?fromtype=readershare&bid=' . $bid . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
  1960. }*/
  1961. $book = BookService::getBookById(Hashids::decode($bid)[0]);
  1962. $first_cid = $book->first_cid;
  1963. $share_url = 'https://site' . encodeDistributionChannelId($this->distribution_channel_id) . '.' . env('SHARE_DOMAIN') . '/reader?fromtype=readershare&bid=' . $bid . '&cid=' . ($first_cid) . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
  1964. if (in_array($this->distribution_channel_id, [2, 14])) {
  1965. $js_config = ChapterShareWechatConfigService::getConfig($url);
  1966. $share_url = 'https://site' . ($this->distribution_channel_id) . '.' . env('SHARE_DOMAIN') . '/reader?fromtype=readershare&bid=' . $bid . '&cid=' . ($first_cid) . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
  1967. }
  1968. $js_config['share_url'] = $share_url;
  1969. /*} catch (\Exception $e) {
  1970. \Log::error($e->getMessage());
  1971. }*/
  1972. //\Log::info($js_config);
  1973. return response()->success($js_config);
  1974. }
  1975. }