|
@@ -90,7 +90,6 @@ class Demo extends Api
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
$map_agent = [
|
|
|
'month_date' => date('Ym'),
|
|
|
'province_id' => $shop_info['province_id'],
|
|
@@ -115,6 +114,68 @@ class Demo extends Api
|
|
|
|
|
|
|
|
|
public function yewuyuan(){
|
|
|
+ $user_id = 1;
|
|
|
+
|
|
|
+
|
|
|
+ $count1 = Db::name('hotel')->where('invite_id',$user_id)->count();
|
|
|
+ $count2 = Db::name('hotel_canteen')->where('invite_id',$user_id)->count();
|
|
|
+ $count3 = Db::name('university_event')->where('invite_id',$user_id)->count();
|
|
|
+ $count4 = Db::name('offline_shop')->where('invite_id',$user_id)->count();
|
|
|
+
|
|
|
+ $invite_count = $count1 + $count2 + $count3 + $count4;
|
|
|
+
|
|
|
+
|
|
|
+ $count1_mon = Db::name('hotel')->where('invite_id',$user_id)->whereTime('create_time','last month')->count();
|
|
|
+ $count2_mon = Db::name('hotel_canteen')->where('invite_id',$user_id)->whereTime('create_time','last month')->count();
|
|
|
+ $count3_mon = Db::name('university_event')->where('invite_id',$user_id)->whereTime('create_time','last month')->count();
|
|
|
+ $count4_mon = Db::name('offline_shop')->where('invite_id',$user_id)->whereTime('create_time','last month')->count();
|
|
|
+
|
|
|
+ $invite_count_mon = $count1_mon + $count2_mon + $count3_mon + $count4_mon;
|
|
|
+
|
|
|
+
|
|
|
+ $invite_amount = Db::name('bill')->field('sum(total_amount * back_rate / 100) as back_amount')
|
|
|
+ ->where('shop_invite_id',$user_id)->whereTime('back_time','last month')->where('back_status',2)
|
|
|
+ ->find();
|
|
|
+
|
|
|
+
|
|
|
+ $invite_uids = Db::name('user')->where('invite_id',$user_id)->column('id');
|
|
|
+ $invite_amount_tuandui = Db::name('bill')->where('shop_invite_id','IN',$invite_uids)->field('sum(total_amount * back_rate / 100) as back_amount')->find();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $butie = 0;
|
|
|
+ $ticheng = 0;
|
|
|
+
|
|
|
+
|
|
|
+ if($invite_amount_tuandui >= 800000 && $invite_amount >= 70000 && $invite_count >= 10){
|
|
|
+ $butie = 12000;
|
|
|
+ $ticheng_rate = 5;
|
|
|
+
|
|
|
+ $ticheng = bcdiv(bcmul($invite_amount,$ticheng_rate,2),100,2);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if($invite_amount_tuandui >= 200000 && $invite_amount >= 70000 && $invite_count >= 10){
|
|
|
+ $butie = 7000;
|
|
|
+ $ticheng_rate = 5;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if($invite_amount >= 60000 && $invite_count_mon >= 5){
|
|
|
+ $butie = 5000;
|
|
|
+ $ticheng_rate = 5;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if($invite_amount >= 30000 && $invite_count_mon >= 3){
|
|
|
+ $butie = 3000;
|
|
|
+ $ticheng_rate = 3;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|