|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace App\Http\Controllers\QuickApp\Book;
|
|
namespace App\Http\Controllers\QuickApp\Book;
|
|
|
|
|
|
|
|
+use App\Modules\Push\Models\QappPushTask;
|
|
use App\Modules\SendOrder\Models\SendOrder;
|
|
use App\Modules\SendOrder\Models\SendOrder;
|
|
use App\Modules\SendOrder\Services\SendOrderService;
|
|
use App\Modules\SendOrder\Services\SendOrderService;
|
|
use App\Modules\Statistic\Services\WapVisitStatService;
|
|
use App\Modules\Statistic\Services\WapVisitStatService;
|
|
@@ -31,9 +32,11 @@ class ChapterController extends BaseController
|
|
{
|
|
{
|
|
|
|
|
|
private $book_info;
|
|
private $book_info;
|
|
|
|
+ private $push_id;
|
|
|
|
|
|
public function getCatalog(Request $request, $bid)
|
|
public function getCatalog(Request $request, $bid)
|
|
{
|
|
{
|
|
|
|
+ $this->push_id = $request->header('x-pushid', '');
|
|
$bid = BookService::decodeBidStatic($bid);
|
|
$bid = BookService::decodeBidStatic($bid);
|
|
$lists = ChapterService::getChapterLists($bid);
|
|
$lists = ChapterService::getChapterLists($bid);
|
|
$book_info = BookConfigService::getBookById($bid);
|
|
$book_info = BookConfigService::getBookById($bid);
|
|
@@ -47,6 +50,7 @@ class ChapterController extends BaseController
|
|
|
|
|
|
public function getCatalogPerPage(Request $request, $bid)
|
|
public function getCatalogPerPage(Request $request, $bid)
|
|
{
|
|
{
|
|
|
|
+ $this->push_id = $request->header('x-pushid', '');
|
|
$bid = BookService::decodeBidStatic($bid);
|
|
$bid = BookService::decodeBidStatic($bid);
|
|
$book_info = BookConfigService::getBookById($bid);
|
|
$book_info = BookConfigService::getBookById($bid);
|
|
if (!$book_info) {
|
|
if (!$book_info) {
|
|
@@ -252,6 +256,8 @@ class ChapterController extends BaseController
|
|
|
|
|
|
public function index(Request $request, $bid, $cid)
|
|
public function index(Request $request, $bid, $cid)
|
|
{
|
|
{
|
|
|
|
+ $this->push_id = $request->header('x-pushid', '');
|
|
|
|
+
|
|
$send_order_id = $request->header('send_order_id', '');
|
|
$send_order_id = $request->header('send_order_id', '');
|
|
$package = $request->header('x-package', '');
|
|
$package = $request->header('x-package', '');
|
|
//每次绑定用户和派单的关系
|
|
//每次绑定用户和派单的关系
|
|
@@ -527,6 +533,7 @@ class ChapterController extends BaseController
|
|
|
|
|
|
public function pay(Request $request, $bid, $cid)
|
|
public function pay(Request $request, $bid, $cid)
|
|
{
|
|
{
|
|
|
|
+ $this->push_id = $request->header('x-pushid', '');
|
|
$remind = (int)$request->input('remind');
|
|
$remind = (int)$request->input('remind');
|
|
$oldbid = $bid;
|
|
$oldbid = $bid;
|
|
$bid = BookService::decodeBidStatic($bid);
|
|
$bid = BookService::decodeBidStatic($bid);
|
|
@@ -661,6 +668,8 @@ class ChapterController extends BaseController
|
|
*/
|
|
*/
|
|
protected function getChapter($bid, $cid, $chapter)
|
|
protected function getChapter($bid, $cid, $chapter)
|
|
{
|
|
{
|
|
|
|
+
|
|
|
|
+
|
|
$chapter_content = ChapterService::getChapter($bid, $cid);
|
|
$chapter_content = ChapterService::getChapter($bid, $cid);
|
|
if (!$chapter_content) return false;
|
|
if (!$chapter_content) return false;
|
|
$chapter->content = trim(str_replace($chapter_content->name, '', $chapter_content->content));
|
|
$chapter->content = trim(str_replace($chapter_content->name, '', $chapter_content->content));
|
|
@@ -685,9 +694,17 @@ class ChapterController extends BaseController
|
|
$chapter->force_add_desk_type = $force_add_desk_type;
|
|
$chapter->force_add_desk_type = $force_add_desk_type;
|
|
$force_add_work_wechat_type = 0;
|
|
$force_add_work_wechat_type = 0;
|
|
$force_add_work_wechat_url = "";
|
|
$force_add_work_wechat_url = "";
|
|
|
|
+
|
|
|
|
+ // 派单企微弹出查询
|
|
if($is_need_query_send_order){
|
|
if($is_need_query_send_order){
|
|
[$force_add_work_wechat_type, $force_add_work_wechat_url] = $this->addWorkWechatType($chapter->sequence);
|
|
[$force_add_work_wechat_type, $force_add_work_wechat_url] = $this->addWorkWechatType($chapter->sequence);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // push企微弹出查询
|
|
|
|
+ if ($this->push_id > 0 && $force_add_work_wechat_type == 0){
|
|
|
|
+ [$force_add_work_wechat_type, $force_add_work_wechat_url] = $this->addWorkWechatType($chapter->sequence,2);
|
|
|
|
+ }
|
|
|
|
+
|
|
$chapter->force_add_work_wechat_type = $force_add_work_wechat_type;
|
|
$chapter->force_add_work_wechat_type = $force_add_work_wechat_type;
|
|
$chapter->force_add_work_wechat_url = $force_add_work_wechat_url;
|
|
$chapter->force_add_work_wechat_url = $force_add_work_wechat_url;
|
|
//统计
|
|
//统计
|
|
@@ -1061,20 +1078,40 @@ class ChapterController extends BaseController
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private function addWorkWechatType($sequence)
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取章节详情企微弹窗设置
|
|
|
|
+ * name: addWorkWechatType
|
|
|
|
+ * @param mixed $sequence 章节序号
|
|
|
|
+ * @param mixed $type 类型 1 派单 2 push
|
|
|
|
+ * @return array
|
|
|
|
+ * date 2023/02/13 16:08
|
|
|
|
+ */
|
|
|
|
+ private function addWorkWechatType($sequence,$type = 1)
|
|
{
|
|
{
|
|
- $deault_force_add_desk_type = 0;
|
|
|
|
|
|
+ $default_force_add_desk_type = 0;
|
|
$work_wechat_url = "";
|
|
$work_wechat_url = "";
|
|
- $send_order_id = $this->GetBindSendOrderId($this->uid);
|
|
|
|
- if ($send_order_id) {
|
|
|
|
- $send_order_info = QappSendOrder::getSendOrderById($send_order_id);
|
|
|
|
- if (!$send_order_info) return [$deault_force_add_desk_type, $work_wechat_url];
|
|
|
|
- if($send_order_info['force_add_work_wechat_status'] == 1 && $send_order_info['force_add_work_wechat_seq'] <= ($sequence+1)){
|
|
|
|
- $deault_force_add_desk_type =$send_order_info['force_add_work_wechat_type'];
|
|
|
|
- $work_wechat_url =$send_order_info['force_add_work_wechat_url'];
|
|
|
|
|
|
+ if ($type == 1){
|
|
|
|
+ // 派单
|
|
|
|
+ $send_order_id = $this->GetBindSendOrderId($this->uid);
|
|
|
|
+ if ($send_order_id) {
|
|
|
|
+ $send_order_info = QappSendOrder::getSendOrderById($send_order_id);
|
|
|
|
+ if (!$send_order_info) return [$default_force_add_desk_type, $work_wechat_url];
|
|
|
|
+ if($send_order_info['force_add_work_wechat_status'] == 1 && $send_order_info['force_add_work_wechat_seq'] <= ($sequence+1)){
|
|
|
|
+ $default_force_add_desk_type =$send_order_info['force_add_work_wechat_type'];
|
|
|
|
+ $work_wechat_url =$send_order_info['force_add_work_wechat_url'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else if ($type == 2){
|
|
|
|
+ // push
|
|
|
|
+ $pushInfo = QappPushTask::where(['id' => $this->push_id,'uid' => $this->distribution_channel_id])
|
|
|
|
+ ->select('id','force_add_work_wechat_status','force_add_work_wechat_type','force_add_work_wechat_seq','force_add_work_wechat_url')->first() ;
|
|
|
|
+ if (!$pushInfo) return [$default_force_add_desk_type, $work_wechat_url];
|
|
|
|
+ if($pushInfo['force_add_work_wechat_status'] == 1 && $pushInfo['force_add_work_wechat_seq'] <= ($sequence+1)){
|
|
|
|
+ $default_force_add_desk_type =$pushInfo['force_add_work_wechat_type'];
|
|
|
|
+ $work_wechat_url = $pushInfo['force_add_work_wechat_url'];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return [$deault_force_add_desk_type, $work_wechat_url];
|
|
|
|
|
|
+ return [$default_force_add_desk_type, $work_wechat_url];
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1183,6 +1220,13 @@ class ChapterController extends BaseController
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取用户相关的企微测试
|
|
|
|
+ * name: getWorkWechatInfo
|
|
|
|
+ * @param $bid
|
|
|
|
+ * @return array
|
|
|
|
+ * date 2023/02/13 16:58
|
|
|
|
+ */
|
|
private function getWorkWechatInfo($bid)
|
|
private function getWorkWechatInfo($bid)
|
|
{
|
|
{
|
|
$info = ['force_add_work_wechat_type' => 0,'force_add_work_wechat_url' => "",'force_add_work_wechat_seq' => 0];
|
|
$info = ['force_add_work_wechat_type' => 0,'force_add_work_wechat_url' => "",'force_add_work_wechat_seq' => 0];
|
|
@@ -1195,13 +1239,22 @@ class ChapterController extends BaseController
|
|
$info['force_add_work_wechat_type'] = $send_order_info['force_add_work_wechat_type'];
|
|
$info['force_add_work_wechat_type'] = $send_order_info['force_add_work_wechat_type'];
|
|
$info['force_add_work_wechat_url'] = $send_order_info['force_add_work_wechat_url'];
|
|
$info['force_add_work_wechat_url'] = $send_order_info['force_add_work_wechat_url'];
|
|
$info['force_add_work_wechat_seq'] = $send_order_info['force_add_work_wechat_seq'];
|
|
$info['force_add_work_wechat_seq'] = $send_order_info['force_add_work_wechat_seq'];
|
|
- }else{
|
|
|
|
-
|
|
|
|
- return $info;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if($info['force_add_work_wechat_type'] == 0 && $this->push_id > 0){
|
|
|
|
+ $pushInfo = QappPushTask::where(['id' => $this->push_id,'uid' => $this->distribution_channel_id])
|
|
|
|
+ ->select('id','force_add_work_wechat_status','force_add_work_wechat_type','force_add_work_wechat_seq','force_add_work_wechat_url')->first() ;
|
|
|
|
+ if($pushInfo['force_add_work_wechat_status'] == 1){
|
|
|
|
+ $info['force_add_work_wechat_type'] = $pushInfo['force_add_work_wechat_type'];
|
|
|
|
+ $info['force_add_work_wechat_url'] = $pushInfo['force_add_work_wechat_url'];
|
|
|
|
+ $info['force_add_work_wechat_seq'] =$pushInfo['force_add_work_wechat_seq'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
return $info;
|
|
return $info;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|