You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.8 KiB
81 lines
2.8 KiB
<?php
|
|
|
|
namespace app\api\controller\wanlshop;
|
|
|
|
use app\admin\model\user\squire\Log as Slog;
|
|
use app\common\model\User;
|
|
use app\common\model\MoneyLog;
|
|
use app\common\controller\Api;
|
|
use fast\Tree;
|
|
use think\Db;
|
|
|
|
/**
|
|
* WanlShop产品接口
|
|
*/
|
|
class Redpocket extends Api
|
|
{
|
|
protected $noNeedLogin = '';
|
|
protected $noNeedRight = ['*'];
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
$this->model = model('app\admin\model\user\redpocket\Log');
|
|
}
|
|
public function getredpocketlog(){
|
|
$uid = $this->auth->id;
|
|
//查询红包明细
|
|
//设置过滤方法
|
|
$data = $this->request->post();
|
|
$page = $data['page'];
|
|
$where = ['uid'=>$uid];
|
|
if(isset($data['createtime']) && $data['createtime']){
|
|
$where['createtime'] = ['like',"{$data['createtime']}%"];
|
|
}
|
|
// 查询数据
|
|
$list = $this->model
|
|
->where($where)
|
|
->paginate(['page'=> $page?? 1,'list_rows' => 10]);
|
|
$return['redpocketNum'] = $this->auth->redpocket;
|
|
$return['list'] = $list;
|
|
return $this->success("获取红包明细成功",$return);
|
|
}
|
|
public function getmoneylog(){
|
|
$uid = $this->auth->id;
|
|
//查询红包明细
|
|
//设置过滤方法
|
|
$data = $this->request->post();
|
|
$page = $data['page'];
|
|
$where = ['user_id'=>$uid];
|
|
if(isset($data['createtime']) && $data['createtime']){
|
|
}else{
|
|
$data['createtime'] = date("Y-m",time());
|
|
}
|
|
// 查询数据
|
|
$list = MoneyLog::where($where)->whereRaw("FROM_UNIXTIME(createtime,'%Y-%m')='{$data['createtime']}'")
|
|
->paginate(['page'=> $page?? 1,'list_rows' => 10]);
|
|
$return['money'] = $this->auth->money;
|
|
$return['list'] = $list;
|
|
return $this->success("获取余额明细成功",$return);
|
|
}
|
|
public function gettuiguanglog(){
|
|
$uid = $this->auth->id;
|
|
$data = $this->request->post();
|
|
$page = $data['page'];
|
|
$where = ['uid'=>$uid];
|
|
$redpocket = Slog::where($where)->where('status',1)->where('type',1)->sum('number');
|
|
$money = Slog::where($where)->where('status',1)->where('type',2)->sum('number');
|
|
$list = Slog::where($where)
|
|
->paginate(['page'=> $page?? 1,'list_rows' => 10]);
|
|
foreach($list as $key => &$val){
|
|
$userinfo = User::get($val['xuid']);
|
|
$val['nickname'] = $userinfo['nickname'];
|
|
$val['avatar'] = $userinfo['avatar'];
|
|
$val['content'] = $val['type']==1?"红包收益 +{$val['number']}个":"余额收益 +{$val['number']}元";
|
|
}
|
|
$return['money'] = $money;
|
|
$return['redpocket'] = $redpocket;
|
|
$return['list'] = $list;
|
|
return $this->success("获取推广明细成功",$return);
|
|
}
|
|
} |