setter
							parent
							
								
									bb4e60e5db
								
							
						
					
					
						commit
						13682f80c8
					
				|  | @ -890,15 +890,43 @@ if (!function_exists('is_mobile')) { | ||||||
|  * @param string $day2 |  * @param string $day2 | ||||||
|  * @return number |  * @return number | ||||||
|  */ |  */ | ||||||
| function diffBetweenTwoDays ($day1, $day2) | if (!function_exists('diffBetweenTwoDays')) { | ||||||
| { |     function diffBetweenTwoDays ($day1, $day2) | ||||||
|     $second1 = strtotime($day1); |     { | ||||||
|     $second2 = strtotime($day2); |         $second1 = strtotime($day1); | ||||||
|  |         $second2 = strtotime($day2); | ||||||
| 
 | 
 | ||||||
|     if ($second1 < $second2) { |         if ($second1 < $second2) { | ||||||
|         $tmp = $second2; |             $tmp = $second2; | ||||||
|         $second2 = $second1; |             $second2 = $second1; | ||||||
|         $second1 = $tmp; |             $second1 = $tmp; | ||||||
|  |         } | ||||||
|  |         return ($second1 - $second2) / 86400; | ||||||
|     } |     } | ||||||
|     return ($second1 - $second2) / 86400; | } | ||||||
| } | 
 | ||||||
|  | /** | ||||||
|  |  * 获取当前毫秒数 | ||||||
|  |  * */ | ||||||
|  | if (!function_exists('msectime')) { | ||||||
|  |     function msectime() { | ||||||
|  |         list($msec, $sec) = explode(' ', microtime()); | ||||||
|  |         $msectime = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000); | ||||||
|  |         return $msectime; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | if (!function_exists('filterEmoji')) { | ||||||
|  |     function filterEmoji($str) | ||||||
|  |     { | ||||||
|  |         $str = preg_replace_callback( | ||||||
|  |             '/./u', | ||||||
|  |             function (array $match) { | ||||||
|  |                 return strlen($match[0]) >= 4 ? '' : $match[0]; | ||||||
|  |             }, | ||||||
|  |             $str); | ||||||
|  | 
 | ||||||
|  |         return $str; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -293,11 +293,13 @@ class Coupon extends Base | ||||||
|      * */ |      * */ | ||||||
|     public function verification() |     public function verification() | ||||||
|     { |     { | ||||||
|         $accountId      = $this->request->user['user_id'] ?? 0; | 
 | ||||||
|         $lat            = input("lat/f",0); |         $accountId      =   $this->request->user['user_id'] ?? 0; | ||||||
|         $lng            =  input("lng/f",0); |         $lat            =   input("lat/f",0); | ||||||
|         $couponId       =  input("couponId/d",0); |         $lng            =   input("lng/f",0); | ||||||
|         $account        = AccountRepository::getInstance()->findById($accountId, [], function ($q) { |         $couponId       =   input("couponId/d",0); | ||||||
|  |         $userTimeStamp  =   input("userTimeStamp/d",0); | ||||||
|  |         $account        =   AccountRepository::getInstance()->findById($accountId, [], function ($q) { | ||||||
|             return $q->with(['business', 'parent']); |             return $q->with(['business', 'parent']); | ||||||
|         }); |         }); | ||||||
|         $time = time(); |         $time = time(); | ||||||
|  | @ -357,10 +359,13 @@ class Coupon extends Base | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         //签到距离
 |  | ||||||
|         Config::load('extra/wechat', 'wechat'); |  | ||||||
|         $signDistance = config('wechat.signDistance') ?? 0; |  | ||||||
| 
 | 
 | ||||||
|  |         Config::load('extra/wechat', 'wechat'); | ||||||
|  |         $signDistance   = config('wechat.signDistance') ?? 0; | ||||||
|  |         $signTimeStamp  = config('wechat.signTimeStamp') ?? 0; | ||||||
|  |         $msectime       = msectime();//毫秒时间戳
 | ||||||
|  | 
 | ||||||
|  |         //签到距离
 | ||||||
|         if($signDistance > 0 ){ |         if($signDistance > 0 ){ | ||||||
|                 $distance =   get_distance($coupon->couponMain->lat,$coupon->couponMain->lng,$lat,$lng); |                 $distance =   get_distance($coupon->couponMain->lat,$coupon->couponMain->lng,$lat,$lng); | ||||||
|                 if($distance > $signDistance){ |                 if($distance > $signDistance){ | ||||||
|  | @ -373,6 +378,14 @@ class Coupon extends Base | ||||||
|                 } |                 } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         //签到时间戳
 | ||||||
|  |         if($signTimeStamp > 0 ){ | ||||||
|  |             if(abs($userTimeStamp - $msectime)  > $signTimeStamp){ | ||||||
|  |                 //.abs($userTimeStamp - $msectime)
 | ||||||
|  |                 return $this->json(4001, "时间戳验证失败"); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
|         $business =  BusinessRepository::getInstance()->getModel()->with(["agency"])->where(["code"=>$coupon->couponMain->business_code])->lock(true)->find(); |         $business =  BusinessRepository::getInstance()->getModel()->with(["agency"])->where(["code"=>$coupon->couponMain->business_code])->lock(true)->find(); | ||||||
|         if(empty($business)){ |         if(empty($business)){ | ||||||
|  |  | ||||||
|  | @ -88,7 +88,7 @@ class User extends Base | ||||||
|                     'create_time'       => $nowDate, |                     'create_time'       => $nowDate, | ||||||
|                     'login_time'        => $nowDate, |                     'login_time'        => $nowDate, | ||||||
|                     'type'              => Account::type_consumer, // 默认为普通消费者
 |                     'type'              => Account::type_consumer, // 默认为普通消费者
 | ||||||
|                     'nick_name'         => $params['nick_name'] ?: generateDefaultNickName(), |                     'nick_name'         => filterEmoji($params['nick_name']) ?: generateDefaultNickName(), | ||||||
|                     'avatar_url'        => $params['avatar_url'] ?: Account::DEFAULT_AVATAR, |                     'avatar_url'        => $params['avatar_url'] ?: Account::DEFAULT_AVATAR, | ||||||
|                     'gender'            => $params['gender'], |                     'gender'            => $params['gender'], | ||||||
|                     'real_name'         => $params['real_name'], |                     'real_name'         => $params['real_name'], | ||||||
|  |  | ||||||
|  | @ -89,12 +89,26 @@ class Bill extends Base | ||||||
|             $size = $this->request->param('size/d', 30); |             $size = $this->request->param('size/d', 30); | ||||||
|             $orders = ['a.id' => 'desc']; |             $orders = ['a.id' => 'desc']; | ||||||
|             $list = $repo->deductionBillList($page, $size, $keyword, $startTime, $endTime, $orders); |             $list = $repo->deductionBillList($page, $size, $keyword, $startTime, $endTime, $orders); | ||||||
|             $list['deduction_money_sum'] = BillRepository::getInstance()->getDeductionMoneySum($keyword,$startTime, $endTime); |             $list['deduction_money_sum']            = BillRepository::getInstance() | ||||||
|  |                 ->getDeductionMoneySum($keyword,$startTime, $endTime);//总流水
 | ||||||
|  |             $list['deduction_money_sum_red_pack']   = BillRepository::getInstance() | ||||||
|  |                 ->getDeductionMoneySumRedPack($keyword,$startTime, $endTime);//消费者红包流水
 | ||||||
|  |             $list['deduction_money_sum_agency']     = BillRepository::getInstance() | ||||||
|  |                 ->getDeductionMoneySumAgency($keyword,$startTime, $endTime);//平台商收益
 | ||||||
|  |             $list['deduction_money_sum_taigu']      = BillRepository::getInstance() | ||||||
|  |                 ->getDeductionMoneySumTaigu($keyword,$startTime, $endTime);//太古收益
 | ||||||
| 
 | 
 | ||||||
|             return $this->json(0, 'success', $list); |             return $this->json(0, 'success', $list); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         $this->data["deduction_money_sum"] = BillRepository::getInstance()->getDeductionMoneySum(); |         $this->data["deduction_money_sum"]              = BillRepository::getInstance() | ||||||
|  |             ->getDeductionMoneySum();//当前总流水
 | ||||||
|  |         $this->data["deduction_money_sum_red_pack"]     = BillRepository::getInstance() | ||||||
|  |             ->getDeductionMoneySumRedPack();//消费者红包流水
 | ||||||
|  |         $this->data["deduction_money_sum_agency"]       = BillRepository::getInstance() | ||||||
|  |             ->getDeductionMoneySumAgency();//平台商收益
 | ||||||
|  |         $this->data["deduction_money_sum_taigu"]        = BillRepository::getInstance() | ||||||
|  |             ->getDeductionMoneySumTaigu();//太古收益
 | ||||||
| 
 | 
 | ||||||
|         $this->data["startTime"] = $startTime; |         $this->data["startTime"] = $startTime; | ||||||
|         $this->data["endTime"] = $endTime; |         $this->data["endTime"] = $endTime; | ||||||
|  |  | ||||||
|  | @ -328,7 +328,7 @@ class BillRepository extends Repository | ||||||
|             ->join("coupon_bill d", "a.bill_id = d.id") |             ->join("coupon_bill d", "a.bill_id = d.id") | ||||||
|             ->join("account b", "d.user_code = b.user_code", "left") |             ->join("account b", "d.user_code = b.user_code", "left") | ||||||
|             ->when(!empty($keyword), function ($q) use ($keyword) { |             ->when(!empty($keyword), function ($q) use ($keyword) { | ||||||
|                 $q->where("c.business_name|f.business_name", "like", "%" . $keyword . "%"); |                 $q->where("e.name|c.business_name|f.business_name", "like", "%" . $keyword . "%"); | ||||||
|             }) |             }) | ||||||
|             ->when(!empty($start_time), function ($q) use ($start_time) { |             ->when(!empty($start_time), function ($q) use ($start_time) { | ||||||
|                 $q->whereTime("a.create_time", ">=", $start_time); |                 $q->whereTime("a.create_time", ">=", $start_time); | ||||||
|  | @ -338,5 +338,86 @@ class BillRepository extends Repository | ||||||
|             }) |             }) | ||||||
|             ->sum("a.money"); |             ->sum("a.money"); | ||||||
|     } |     } | ||||||
|  |     /** | ||||||
|  |      * 总扣款流水-消费者红包 | ||||||
|  |      * @param null $keyword | ||||||
|  |      * @param null $start_time | ||||||
|  |      * @param null $end_time | ||||||
|  |      * @return float | ||||||
|  |      */ | ||||||
|  |     public function getDeductionMoneySumRedPack($keyword = null,$start_time = null, $end_time = null) | ||||||
|  |     { | ||||||
|  |         return Deduction::alias("a") | ||||||
|  |             ->join("business c", "a.business_code = c.code") | ||||||
|  |             ->join("business f", "f.code = c.agency_code", "left") | ||||||
|  |             ->join("coupon_main e", "a.coupon_main_id = e.id") | ||||||
|  |             ->join("coupon_bill d", "a.bill_id = d.id") | ||||||
|  |             ->join("account b", "d.user_code = b.user_code", "left") | ||||||
|  |             ->when(!empty($keyword), function ($q) use ($keyword) { | ||||||
|  |                 $q->where("e.name|c.business_name|f.business_name", "like", "%" . $keyword . "%"); | ||||||
|  |             }) | ||||||
|  |             ->when(!empty($start_time), function ($q) use ($start_time) { | ||||||
|  |                 $q->whereTime("a.create_time", ">=", $start_time); | ||||||
|  |             }) | ||||||
|  |             ->when(!empty($end_time), function ($q) use ($end_time) { | ||||||
|  |                 $q->whereTime("a.create_time", "<=", $end_time); | ||||||
|  |             }) | ||||||
|  |             ->sum("d.consumer_money"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 总扣款流水-平台商收益 | ||||||
|  |      * @param null $keyword | ||||||
|  |      * @param null $start_time | ||||||
|  |      * @param null $end_time | ||||||
|  |      * @return float | ||||||
|  |      */ | ||||||
|  |     public function getDeductionMoneySumAgency($keyword = null,$start_time = null, $end_time = null) | ||||||
|  |     { | ||||||
|  |         return Deduction::alias("a") | ||||||
|  |             ->join("business c", "a.business_code = c.code") | ||||||
|  |             ->join("business f", "f.code = c.agency_code", "left") | ||||||
|  |             ->join("coupon_main e", "a.coupon_main_id = e.id") | ||||||
|  |             ->join("coupon_bill d", "a.bill_id = d.id") | ||||||
|  |             ->join("account b", "d.user_code = b.user_code", "left") | ||||||
|  |             ->when(!empty($keyword), function ($q) use ($keyword) { | ||||||
|  |                 $q->where("e.name|c.business_name|f.business_name", "like", "%" . $keyword . "%"); | ||||||
|  |             }) | ||||||
|  |             ->when(!empty($start_time), function ($q) use ($start_time) { | ||||||
|  |                 $q->whereTime("a.create_time", ">=", $start_time); | ||||||
|  |             }) | ||||||
|  |             ->when(!empty($end_time), function ($q) use ($end_time) { | ||||||
|  |                 $q->whereTime("a.create_time", "<=", $end_time); | ||||||
|  |             }) | ||||||
|  |             ->sum("d.agency_money"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 总扣款流水-太古收益 | ||||||
|  |      * @param null $keyword | ||||||
|  |      * @param null $start_time | ||||||
|  |      * @param null $end_time | ||||||
|  |      * @return float | ||||||
|  |      */ | ||||||
|  |     public function getDeductionMoneySumTaigu($keyword = null,$start_time = null, $end_time = null) | ||||||
|  |     { | ||||||
|  |         return Deduction::alias("a") | ||||||
|  |             ->join("business c", "a.business_code = c.code") | ||||||
|  |             ->join("business f", "f.code = c.agency_code", "left") | ||||||
|  |             ->join("coupon_main e", "a.coupon_main_id = e.id") | ||||||
|  |             ->join("coupon_bill d", "a.bill_id = d.id") | ||||||
|  |             ->join("account b", "d.user_code = b.user_code", "left") | ||||||
|  |             ->when(!empty($keyword), function ($q) use ($keyword) { | ||||||
|  |                 $q->where("e.name|c.business_name|f.business_name", "like", "%" . $keyword . "%"); | ||||||
|  |             }) | ||||||
|  |             ->when(!empty($start_time), function ($q) use ($start_time) { | ||||||
|  |                 $q->whereTime("a.create_time", ">=", $start_time); | ||||||
|  |             }) | ||||||
|  |             ->when(!empty($end_time), function ($q) use ($end_time) { | ||||||
|  |                 $q->whereTime("a.create_time", "<=", $end_time); | ||||||
|  |             }) | ||||||
|  |             ->sum("d.admin_money"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | @ -6,6 +6,6 @@ | ||||||
|    RewriteCond %{REQUEST_FILENAME} !-f |    RewriteCond %{REQUEST_FILENAME} !-f | ||||||
|    RewriteCond %{REQUEST_URI} !^(.*)\.(gif|jpg|jpeg|png|swf|mp4)$ [NC] |    RewriteCond %{REQUEST_URI} !^(.*)\.(gif|jpg|jpeg|png|swf|mp4)$ [NC] | ||||||
|    RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L] |    RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L] | ||||||
|     #增加如下内容 |     #增加如下内容 | ||||||
|    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0 |    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0 | ||||||
|  </IfModule> |  </IfModule> | ||||||
|  | @ -24,23 +24,63 @@ | ||||||
|     <div class="layui-row layui-col-space15"> |     <div class="layui-row layui-col-space15"> | ||||||
| 
 | 
 | ||||||
|         </div> |         </div> | ||||||
|         <div class="layui-col-md10"> |         <div class="layui-col-md12"> | ||||||
|             <div class="layui-row "> |             <div class="layui-row "> | ||||||
|                 <div class="layui-col-md6"> |                 <div class="layui-col-md6"> | ||||||
|                     <div class="layui-panel" style="border-radius: 8px;"> |                     <div class="layui-panel" style="border-radius: 8px;"> | ||||||
|  | <!--                        <div class="layui-row" style="padding: 5% 0;text-align: center">--> | ||||||
|  | <!--                            <h3><strong>总扣款流水:</strong></h3>--> | ||||||
|  | <!--                            <span class="l_font" >{$deduction_money_sum ?? 0}</span>--> | ||||||
|  | <!--                        </div>--> | ||||||
|  | 
 | ||||||
|                         <div class="layui-row" style="padding: 5% 0;text-align: center"> |                         <div class="layui-row" style="padding: 5% 0;text-align: center"> | ||||||
|                             <h3><strong>总扣款流水:</strong></h3> |                             <div class="layui-col-md3" style="padding: 5% 0;text-align: center"> | ||||||
|                             <span class="l_font" >{$deduction_money_sum ?? 0}</span> |                                 <h3><strong>总扣款流水:</strong></h3> | ||||||
|  |                                 <span class="l_font" >{$deduction_money_sum ?? 0}</span> | ||||||
|  |                             </div> | ||||||
|  |                             <div class="layui-col-md3" style="padding: 5% 0;text-align: center"> | ||||||
|  |                                 <h3><strong>总消费者红包:</strong></h3> | ||||||
|  |                                 <span class="l_font" >{$deduction_money_sum_red_pack ?? 0}</span> | ||||||
|  |                             </div> | ||||||
|  |                             <div class="layui-col-md3" style="padding: 5% 0;text-align: center"> | ||||||
|  |                                 <h3><strong>总平台佣金:</strong></h3> | ||||||
|  |                                 <span class="l_font" >{$deduction_money_sum_agency ?? 0}</span> | ||||||
|  |                             </div> | ||||||
|  |                             <div class="layui-col-md3" style="padding: 5% 0;text-align: center"> | ||||||
|  |                                 <h3><strong>总太古佣金:</strong></h3> | ||||||
|  |                                 <span class="l_font" >{$deduction_money_sum_taigu ?? 0}</span> | ||||||
|  |                             </div> | ||||||
|                         </div> |                         </div> | ||||||
|  | 
 | ||||||
|                    </div> |                    </div> | ||||||
|                  </div> |                  </div> | ||||||
| 
 | 
 | ||||||
|                 <div class="layui-col-md6"> |                 <div class="layui-col-md6"> | ||||||
|                     <div class="layui-panel" style="border-radius: 8px;"> |                     <div class="layui-panel" style="border-radius: 8px;"> | ||||||
|  | <!--                        <div class="layui-row" style="padding: 5% 0;text-align: center">--> | ||||||
|  | <!--                            <h3><strong>当前扣款流水:</strong></h3>--> | ||||||
|  | <!--                            <span class="l_font" id="deduction_money_sum">  </span>--> | ||||||
|  | <!--                        </div>--> | ||||||
|  | 
 | ||||||
|                         <div class="layui-row" style="padding: 5% 0;text-align: center"> |                         <div class="layui-row" style="padding: 5% 0;text-align: center"> | ||||||
|                             <h3><strong>当前扣款流水:</strong></h3> |                             <div class="layui-col-md3" style="padding: 5% 0;text-align: center"> | ||||||
|                             <span class="l_font" id="deduction_money_sum">  </span> |                                 <h3><strong>当前扣款流水:</strong></h3> | ||||||
|  |                                 <span class="l_font" >{$deduction_money_sum ?? 0}</span> | ||||||
|  |                             </div> | ||||||
|  |                             <div class="layui-col-md3" style="padding: 5% 0;text-align: center"> | ||||||
|  |                                 <h3><strong>当前消费者红包:</strong></h3> | ||||||
|  |                                 <span class="l_font" >{$deduction_money_sum ?? 0}</span> | ||||||
|  |                             </div> | ||||||
|  |                             <div class="layui-col-md3" style="padding: 5% 0;text-align: center"> | ||||||
|  |                                 <h3><strong>当前平台佣金:</strong></h3> | ||||||
|  |                                 <span class="l_font" >{$deduction_money_sum ?? 0}</span> | ||||||
|  |                             </div> | ||||||
|  |                             <div class="layui-col-md3" style="padding: 5% 0;text-align: center"> | ||||||
|  |                                 <h3><strong>当前太古佣金:</strong></h3> | ||||||
|  |                                 <span class="l_font" >{$deduction_money_sum ?? 0}</span> | ||||||
|  |                             </div> | ||||||
|                         </div> |                         </div> | ||||||
|  | 
 | ||||||
|                     </div> |                     </div> | ||||||
|                 </div> |                 </div> | ||||||
| 
 | 
 | ||||||
|  | @ -61,7 +101,7 @@ | ||||||
|                                     <div class="layui-inline"> |                                     <div class="layui-inline"> | ||||||
|                                         <label class="layui-form-label">关键词</label> |                                         <label class="layui-form-label">关键词</label> | ||||||
|                                         <div class="layui-inline"> |                                         <div class="layui-inline"> | ||||||
|                                             <input type="text" name="keyword" class="layui-input" placeholder="商家名称或者优惠券名称"> |                                             <input type="text" name="keyword" class="layui-input" placeholder="平台商|商家名称|优惠券名称"> | ||||||
|                                         </div> |                                         </div> | ||||||
|                                     </div> |                                     </div> | ||||||
|                                     <div class="layui-inline"> |                                     <div class="layui-inline"> | ||||||
|  |  | ||||||
|  | @ -157,6 +157,13 @@ | ||||||
|                     <div class="layui-form-mid layui-word-aux">单位:米,设置签到时用户的位置和商家的地理位置最大不能超过多少米(<span style="color: red">0表示不限 不可为负数</span>)</div> |                     <div class="layui-form-mid layui-word-aux">单位:米,设置签到时用户的位置和商家的地理位置最大不能超过多少米(<span style="color: red">0表示不限 不可为负数</span>)</div> | ||||||
|                 </div> |                 </div> | ||||||
| 
 | 
 | ||||||
|  |                 <div class="layui-form-item layui-form-item-lg"> | ||||||
|  |                     <label class="layui-form-label">签到时间戳</label> | ||||||
|  |                     <div class="layui-input-inline"> | ||||||
|  |                         <input class="layui-input" type="text" name="signDistance" value="{$item.signTimeStamp ?? 0}"/> | ||||||
|  |                     </div> | ||||||
|  |                     <div class="layui-form-mid layui-word-aux">单位:毫秒,设置签到时用户上传的时间戳只差不能大于多少毫秒(<span style="color: red">0表示不限 不可为负数 1000毫秒=1秒</span>)</div> | ||||||
|  |                 </div> | ||||||
|                 <div class="layui-form-item layui-form-item-lg"> |                 <div class="layui-form-item layui-form-item-lg"> | ||||||
|                     <label class="layui-form-label">优惠券最小佣金</label> |                     <label class="layui-form-label">优惠券最小佣金</label> | ||||||
|                     <div class="layui-input-inline"> |                     <div class="layui-input-inline"> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue