|
@@ -57,30 +57,12 @@ class UserRelation extends BaseController
|
|
|
$params['uid'] = $this->request->uid();
|
|
|
$this->repository->create($params);
|
|
|
//关注店铺返利
|
|
|
- $user_info = $repository->get($params['uid']);
|
|
|
- if($user_info->order_id){
|
|
|
+ $user = $repository->get($params['uid']);
|
|
|
+ if($user->order_id){
|
|
|
$percentage_info = $store_percentage->getWhere(array('passivity_user_id'=>$params['uid'],'deduction_type'=>5));
|
|
|
if(empty($percentage_info)){
|
|
|
//一级关注店铺折扣百分比
|
|
|
- $one_attention_percentage = 8;
|
|
|
- $two_attention_percentage = 6;
|
|
|
- //扣减订单剩余支付百分比
|
|
|
- $order_info = $order_epository->findOrCreate(array('order_id'=>$user_info->order_id));
|
|
|
- if($one_attention_percentage > 0){
|
|
|
- //一级关注店铺折扣比
|
|
|
- if(in_array($order_info->status,[4])){
|
|
|
- $order_epository->update($user_info->order_id,array('residue_percentage'=>$order_info->residue_percentage - $one_attention_percentage));
|
|
|
- $store_percentage = app()->make(StorePercentageRepository::class);
|
|
|
- $percentage_data = array(
|
|
|
- 'user_id' => $order_info->uid,
|
|
|
- 'deduction_num' => $one_attention_percentage,
|
|
|
- 'deduction_type' => 5,
|
|
|
- 'passivity_user_id' => $params['uid'],
|
|
|
- 'order_id' => $order_info->order_id
|
|
|
- );
|
|
|
- $store_percentage->create($percentage_data);
|
|
|
- }
|
|
|
- }
|
|
|
+ $store_percentage->deduction_percentage(1,$user->uid,$user->order_id);
|
|
|
if($two_attention_percentage > 0){
|
|
|
$p_user = $repository->get($order_info->uid);
|
|
|
if($p_user->order_id){
|