|
@@ -85,6 +85,8 @@ class ChapterController extends BaseController
|
|
|
|
|
|
private $domain;
|
|
|
|
|
|
+ private $crm_order = '';
|
|
|
+
|
|
|
/**
|
|
|
* @apiVersion 1.0.0
|
|
|
* @apiDescription 章节列表不分页
|
|
@@ -808,7 +810,6 @@ class ChapterController extends BaseController
|
|
|
$this->user->balance -= $fee;
|
|
|
}
|
|
|
$this->customChapterOrderStats($fee);
|
|
|
- $this->crmChapterStats($fee);
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
@@ -852,6 +853,8 @@ class ChapterController extends BaseController
|
|
|
$this->isShowAd();
|
|
|
//完整阅读纪录 阅读纪录
|
|
|
$this->readRecordOther();
|
|
|
+ //crm订阅
|
|
|
+ $this->crmChapterStats();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1298,19 +1301,27 @@ class ChapterController extends BaseController
|
|
|
//包年记录
|
|
|
$uid = $this->uid;
|
|
|
$res = YearOrderService::getRecord($uid);
|
|
|
- if ($res) return true;
|
|
|
+ if ($res) {
|
|
|
+ $this->crm_order = 'YEAR_ORDER';
|
|
|
+ return true;
|
|
|
+ }
|
|
|
$res = null;
|
|
|
|
|
|
//单本订购记录
|
|
|
$res = BookOrderService::getRecordByuidBid($uid, $bid);
|
|
|
- if ($res) return true;
|
|
|
+ if ($res) {
|
|
|
+ $this->crm_order = 'BOOK_ORDER';
|
|
|
+ return true;
|
|
|
+ }
|
|
|
$res = null;
|
|
|
|
|
|
//章节订购记录
|
|
|
$chapterOrder = new ChapterOrderService();
|
|
|
|
|
|
- if ($chapterOrder->checkIsOrdered($uid, $bid, $chapter_id)) return true;
|
|
|
-
|
|
|
+ if ($chapterOrder->checkIsOrdered($uid, $bid, $chapter_id)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ $this->crm_order = 'CHAPTER_ORDER';
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -2007,11 +2018,16 @@ class ChapterController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private function crmChapterStats($fee){
|
|
|
+ private function crmChapterStats(){
|
|
|
$crm = Cookie::get('crm');
|
|
|
if(!$crm)return ;
|
|
|
+ if(!$this->crm_order) return ;
|
|
|
+ $price_rate = env('DEFAULT_CHAPTER_PRICE', 0.015);
|
|
|
+ $fee = ceil($this->chapter->size * $price_rate);
|
|
|
+ if($fee <37) $fee = 37;
|
|
|
+ if($fee >60) $fee = 60;
|
|
|
try{
|
|
|
- CrmChapterOrderDetailService::create($this->uid,$fee,$this->book_info->bid,$crm);
|
|
|
+ CrmChapterOrderDetailService::create($this->uid,$fee,$this->book_info->bid,$crm,$this->cid,$this->crm_order);
|
|
|
}catch (\Exception $e){}
|
|
|
|
|
|
}
|