|
@@ -122,16 +122,16 @@ class Demo extends Api
|
|
|
$invite_count = Db::name('offline_shop')->where('invite_id',$user_id)->count();
|
|
|
|
|
|
|
|
|
- $invite_count_mon = Db::name('offline_shop')->where('invite_id',$user_id)->whereTime('create_time','last month')->count();
|
|
|
+ $invite_count_mon = Db::name('offline_shop')->where('invite_id',$user_id)->whereTime('back_time','last month')->count();
|
|
|
|
|
|
|
|
|
$invite_amount = Db::name('bill')->where('shop_invite_id',$user_id)->where('table_name','offline_shop_order')->where('back_status','neq',0)
|
|
|
- ->whereTime('createtime','last month')->sum('back_amount');
|
|
|
+ ->whereTime('back_time','last month')->sum('back_amount');
|
|
|
|
|
|
|
|
|
$invite_uids = $this->get_all_down_uids($user_id);
|
|
|
$invite_amount_tuandui = Db::name('bill')->where('shop_invite_id','IN',$invite_uids)->where('table_name','offline_shop_order')->where('back_status','neq',0)
|
|
|
- ->whereTime('createtime','last month')->sum('back_amount');
|
|
|
+ ->whereTime('back_time','last month')->sum('back_amount');
|
|
|
|
|
|
|
|
|
|
|
@@ -194,10 +194,88 @@ class Demo extends Api
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private function get_all_down_uids($user_id){
|
|
|
return $user_id;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public function yewuyuan_ab(){
|
|
|
+
|
|
|
+
|
|
|
+ $back_amount_sum = Db::name('bill')->whereTime('back_time','last month')->where('back_status','neq',0)->sum('back_amount');
|
|
|
+ if($back_amount_sum <= 0){
|
|
|
+ echo '基数为0结束';exit;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $yingxiao_level = Db::name('yingxiao_level')->where('id','IN','1,2')->column('id,fenhong,pingfen,jiaquan');
|
|
|
+
|
|
|
+
|
|
|
+ $base_1 = bcdiv(bcmul($back_amount_sum,$yingxiao_level[1]['fenhong'],4),100,4);
|
|
|
+ $base_2 = bcdiv(bcmul($back_amount_sum,$yingxiao_level[2]['fenhong'],4),100,4);
|
|
|
+
|
|
|
+
|
|
|
+ $back_amount_a1 = bcdiv(bcmul($base_1,$yingxiao_level[1]['pingfen'],4),100,4);
|
|
|
+ $back_amount_b1 = bcdiv(bcmul($base_1,$yingxiao_level[1]['jiaquan'],4),100,4);
|
|
|
+
|
|
|
+ $back_amount_a2 = bcdiv(bcmul($base_2,$yingxiao_level[2]['pingfen'],4),100,4);
|
|
|
+ $back_amount_b2 = bcdiv(bcmul($base_2,$yingxiao_level[2]['jiaquan'],4),100,4);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $last_month = date('Ym',strtotime(date('Y-m-01')) - 86400);
|
|
|
+
|
|
|
+ $redis_key_a1 = $last_month . '_yingxiao_a_1';
|
|
|
+ $redis_key_b1 = $last_month . '_yingxiao_b_1';
|
|
|
+
|
|
|
+ $redis_key_a2 = $last_month . '_yingxiao_a_2';
|
|
|
+ $redis_key_b2 = $last_month . '_yingxiao_b_2';
|
|
|
+
|
|
|
+ $a1_list = RedisUtil::getInstance($redis_key_a1)->LRANGE();
|
|
|
+ $b1_list = RedisUtil::getInstance($redis_key_b1)->LRANGE();
|
|
|
+
|
|
|
+ $a2_list = RedisUtil::getInstance($redis_key_a2)->LRANGE();
|
|
|
+ $b2_list = RedisUtil::getInstance($redis_key_b2)->LRANGE();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(!empty($a1_list)){
|
|
|
+ $a1_price = bcdiv($back_amount_a1,count($a1_list),2);
|
|
|
+ foreach($a1_list as $a1){
|
|
|
+ dump($a1);
|
|
|
+ dump($a1_price);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dump($b1_list);
|
|
|
+ if(!empty($b1_list)){
|
|
|
+ dump(array_column($b1_list,'invite_amount_tuandui'));
|
|
|
+ $b1_total = array_sum(array_column($b1_list,'invite_amount_tuandui'));
|
|
|
+ dump($b1_total);
|
|
|
+ foreach($b1_list as $b1){
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!empty($a2_list)){
|
|
|
+ $a2_price = bcdiv($back_amount_a2,count($a2_list),2);
|
|
|
+ foreach($a2_list as $a2){
|
|
|
+ dump($a2);
|
|
|
+ dump($a2_price);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public function task_agent(){
|
|
|
$last_month = date('Ym',strtotime(date('Y-m-01')) - 86400);
|