<?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');
|
}
|
}
|
}
|
|
|
}
|