heyuntao
2023-07-13 3917040b9da73089ad98acc9de91c03daae67178
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
namespace app\api\logic;
 
use app\common\logic\Basic as BasicLogic;
use app\common\model\User as ModelUser;
use app\common\model\UserLevel as ModelUserLevel;
use app\api\library\UniPush as PushService;
 
/**
 * 反佣管理
 */
class Commission extends BasicLogic
{
 
    protected $model = null;
 
    public $field = "id,trade_id,alipay_total_price,pub_share_pre_fee,pub_share_fee,item_img,item_title,tk_status,tb_paid_time,pay_price,tk_earning_time,create_time";
 
    public function __construct()
    {
        parent::__construct();
 
    }
 
 
    /**
     * 根据传入的用户等级,获取对应用户的反佣比例
     *
     * @param [type] $user_id 对应用户ID
     * @return void
     */
    protected function getLevelInfo($level)
    {
        $ModelUserLevel = new ModelUserLevel();
        $levelInfo = $ModelUserLevel->where(['level'=>$level])->find();
        if(empty($levelInfo))  return ['status'=>false,'info'=>'用户反佣比例获取失败'];
        return $levelInfo;
    }
 
 
    /**
     * 推送消息
     *
     * @return void
     */
    public function userPush($data){
        if(!empty($data)){
            $PushService = new PushService();
            foreach($data as $info){
                $user = $info['user'];
                if($user['push_cid'] == "") continue;
                $PushService->pushToSingleByCids($user['push_cid'],$info['title'],$info['body'],'intent','/pages/order/index');
            }
        }
    }
 
 
}