|
|
@@ -26,23 +26,24 @@ class AgentManage extends AuthController
|
|
|
*/
|
|
|
public function index()
|
|
|
{
|
|
|
- $this->assign( 'year',getMonth());
|
|
|
- $this->assign('store_brokerage_statu',sysConfig('store_brokerage_statu'));
|
|
|
+ $this->assign('year', getMonth());
|
|
|
+ $this->assign('store_brokerage_statu', sysConfig('store_brokerage_statu'));
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
+
|
|
|
public function get_spread_list()
|
|
|
{
|
|
|
- $where=Util::getMore([
|
|
|
- ['nickname',''],
|
|
|
- ['start_time',''],
|
|
|
- ['end_time',''],
|
|
|
- ['sex',''],
|
|
|
- ['excel',''],
|
|
|
- ['subscribe',''],
|
|
|
- ['order',''],
|
|
|
- ['page',1],
|
|
|
- ['limit',20],
|
|
|
- ['user_type',''],
|
|
|
+ $where = Util::getMore([
|
|
|
+ ['nickname', ''],
|
|
|
+ ['start_time', ''],
|
|
|
+ ['end_time', ''],
|
|
|
+ ['sex', ''],
|
|
|
+ ['excel', ''],
|
|
|
+ ['subscribe', ''],
|
|
|
+ ['order', ''],
|
|
|
+ ['page', 1],
|
|
|
+ ['limit', 20],
|
|
|
+ ['user_type', ''],
|
|
|
]);
|
|
|
return JsonService::successlayui(UserModel::agentSystemPage($where));
|
|
|
}
|
|
|
@@ -50,9 +51,9 @@ class AgentManage extends AuthController
|
|
|
public function get_badge()
|
|
|
{
|
|
|
$where = Util::postMore([
|
|
|
- ['data',''],
|
|
|
- ['nickname',''],
|
|
|
- ['excel',''],
|
|
|
+ ['data', ''],
|
|
|
+ ['nickname', ''],
|
|
|
+ ['excel', ''],
|
|
|
]);
|
|
|
return JsonService::successful(UserModel::getSpreadBadge($where));
|
|
|
}
|
|
|
@@ -61,32 +62,35 @@ class AgentManage extends AuthController
|
|
|
* 一级推荐人页面
|
|
|
* @return mixed
|
|
|
*/
|
|
|
- public function stair($uid = ''){
|
|
|
- if($uid == '') return $this->failed('参数错误');
|
|
|
- $this->assign('uid',$uid ? : 0);
|
|
|
- $this->assign( 'year',getMonth());
|
|
|
+ public function stair($uid = '')
|
|
|
+ {
|
|
|
+ if ($uid == '') return $this->failed('参数错误');
|
|
|
+ $this->assign('uid', $uid ?: 0);
|
|
|
+ $this->assign('year', getMonth());
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
+
|
|
|
/*
|
|
|
* 统计推广订单
|
|
|
* @param int $uid
|
|
|
* */
|
|
|
public function stair_order($uid = 0)
|
|
|
{
|
|
|
- if($uid == '') return $this->failed('参数错误');
|
|
|
- $this->assign('uid',$uid ? : 0);
|
|
|
- $this->assign( 'year',getMonth());
|
|
|
+ if ($uid == '') return $this->failed('参数错误');
|
|
|
+ $this->assign('uid', $uid ?: 0);
|
|
|
+ $this->assign('year', getMonth());
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
|
|
|
- public function get_stair_order_list(){
|
|
|
+ public function get_stair_order_list()
|
|
|
+ {
|
|
|
$where = Util::getMore([
|
|
|
- ['uid',$this->request->param('uid',0)],
|
|
|
- ['data',''],
|
|
|
- ['order_id',''],
|
|
|
- ['type',''],
|
|
|
- ['page',1],
|
|
|
- ['limit',20],
|
|
|
+ ['uid', $this->request->param('uid', 0)],
|
|
|
+ ['data', ''],
|
|
|
+ ['order_id', ''],
|
|
|
+ ['type', ''],
|
|
|
+ ['page', 1],
|
|
|
+ ['limit', 20],
|
|
|
]);
|
|
|
return JsonService::successlayui(UserModel::getStairOrderList($where));
|
|
|
}
|
|
|
@@ -94,10 +98,10 @@ class AgentManage extends AuthController
|
|
|
public function get_stair_order_badge()
|
|
|
{
|
|
|
$where = Util::getMore([
|
|
|
- ['uid',''],
|
|
|
- ['data',''],
|
|
|
- ['order_id',''],
|
|
|
- ['type',''],
|
|
|
+ ['uid', ''],
|
|
|
+ ['data', ''],
|
|
|
+ ['order_id', ''],
|
|
|
+ ['type', ''],
|
|
|
]);
|
|
|
return JsonService::successful(UserModel::getStairOrderBadge($where));
|
|
|
}
|
|
|
@@ -105,12 +109,12 @@ class AgentManage extends AuthController
|
|
|
public function get_stair_list()
|
|
|
{
|
|
|
$where = Util::getMore([
|
|
|
- ['uid',$this->request->param('uid',0)],
|
|
|
- ['data',''],
|
|
|
- ['nickname',''],
|
|
|
- ['type',''],
|
|
|
- ['page',1],
|
|
|
- ['limit',20],
|
|
|
+ ['uid', $this->request->param('uid', 0)],
|
|
|
+ ['data', ''],
|
|
|
+ ['nickname', ''],
|
|
|
+ ['type', ''],
|
|
|
+ ['page', 1],
|
|
|
+ ['limit', 20],
|
|
|
]);
|
|
|
return JsonService::successlayui(UserModel::getStairList($where));
|
|
|
}
|
|
|
@@ -118,10 +122,10 @@ class AgentManage extends AuthController
|
|
|
public function get_stair_badge()
|
|
|
{
|
|
|
$where = Util::getMore([
|
|
|
- ['uid',''],
|
|
|
- ['data',''],
|
|
|
- ['nickname',''],
|
|
|
- ['type',''],
|
|
|
+ ['uid', ''],
|
|
|
+ ['data', ''],
|
|
|
+ ['nickname', ''],
|
|
|
+ ['type', ''],
|
|
|
]);
|
|
|
return JsonService::successful(UserModel::getSairBadge($where));
|
|
|
}
|
|
|
@@ -132,21 +136,21 @@ class AgentManage extends AuthController
|
|
|
*/
|
|
|
public function stair_two($uid = '')
|
|
|
{
|
|
|
- if($uid == '') return $this->failed('参数错误');
|
|
|
- $spread_uid=User::where('spread_uid',$uid)->column('uid','uid');
|
|
|
- if(count($spread_uid))
|
|
|
- $spread_uid_two=User::where('spread_uid','in',$spread_uid)->column('uid','uid');
|
|
|
+ if ($uid == '') return $this->failed('参数错误');
|
|
|
+ $spread_uid = User::where('spread_uid', $uid)->column('uid', 'uid');
|
|
|
+ if (count($spread_uid))
|
|
|
+ $spread_uid_two = User::where('spread_uid', 'in', $spread_uid)->column('uid', 'uid');
|
|
|
else
|
|
|
- $spread_uid_two=[0];
|
|
|
+ $spread_uid_two = [0];
|
|
|
$list = User::alias('u')
|
|
|
- ->where('u.uid','in',$spread_uid_two)
|
|
|
+ ->where('u.uid', 'in', $spread_uid_two)
|
|
|
->field('u.avatar,u.nickname,u.now_money,u.spread_time,u.uid')
|
|
|
- ->where('u.status',1)
|
|
|
+ ->where('u.status', 1)
|
|
|
->order('u.add_time DESC')
|
|
|
->select()
|
|
|
->toArray();
|
|
|
- foreach ($list as $key=>$value) $list[$key]['orderCount'] = StoreOrder::getOrderCount($value['uid'])?:0;
|
|
|
- $this->assign('list',$list);
|
|
|
+ foreach ($list as $key => $value) $list[$key]['orderCount'] = StoreOrder::getOrderCount($value['uid']) ?: 0;
|
|
|
+ $this->assign('list', $list);
|
|
|
return $this->fetch('stair');
|
|
|
}
|
|
|
|
|
|
@@ -155,25 +159,25 @@ class AgentManage extends AuthController
|
|
|
* */
|
|
|
public function delete_promoter()
|
|
|
{
|
|
|
- list($uids)=Util::postMore([
|
|
|
- ['uids',[]]
|
|
|
- ],$this->request,true);
|
|
|
- if(!count($uids)) return JsonService::fail('请选择需要解除推广权限的用户!');
|
|
|
+ list($uids) = Util::postMore([
|
|
|
+ ['uids', []]
|
|
|
+ ], $this->request, true);
|
|
|
+ if (!count($uids)) return JsonService::fail('请选择需要解除推广权限的用户!');
|
|
|
User::beginTrans();
|
|
|
- try{
|
|
|
- if(User::where('uid','in',$uids)->update(['is_promoter'=>0])){
|
|
|
+ try {
|
|
|
+ if (User::where('uid', 'in', $uids)->update(['is_promoter' => 0])) {
|
|
|
User::commitTrans();
|
|
|
return JsonService::successful('解除成功');
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
User::rollbackTrans();
|
|
|
return JsonService::fail('解除失败');
|
|
|
}
|
|
|
- }catch (\PDOException $e){
|
|
|
+ } catch (\PDOException $e) {
|
|
|
User::rollbackTrans();
|
|
|
- return JsonService::fail('数据库操作错误',['line'=>$e->getLine(),'message'=>$e->getMessage()]);
|
|
|
- }catch (\Exception $e){
|
|
|
+ return JsonService::fail('数据库操作错误', ['line' => $e->getLine(), 'message' => $e->getMessage()]);
|
|
|
+ } catch (\Exception $e) {
|
|
|
User::rollbackTrans();
|
|
|
- return JsonService::fail('系统错误',['line'=>$e->getLine(),'message'=>$e->getMessage()]);
|
|
|
+ return JsonService::fail('系统错误', ['line' => $e->getLine(), 'message' => $e->getMessage()]);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -183,20 +187,20 @@ class AgentManage extends AuthController
|
|
|
* @param int $uid
|
|
|
* @return json
|
|
|
* */
|
|
|
- public function look_code($uid='',$action='')
|
|
|
+ public function look_code($uid = '', $action = '')
|
|
|
{
|
|
|
- if(!$uid || !$action) return JsonService::fail('缺少参数');
|
|
|
- try{
|
|
|
- if(method_exists($this,$action)){
|
|
|
+ if (!$uid || !$action) return JsonService::fail('缺少参数');
|
|
|
+ try {
|
|
|
+ if (method_exists($this, $action)) {
|
|
|
$res = $this->$action($uid);
|
|
|
- if($res)
|
|
|
+ if ($res)
|
|
|
return JsonService::successful($res);
|
|
|
else
|
|
|
- return JsonService::fail(isset($res['msg']) ? $res['msg'] : '获取失败,请稍后再试!' );
|
|
|
- }else
|
|
|
+ return JsonService::fail(isset($res['msg']) ? $res['msg'] : '获取失败,请稍后再试!');
|
|
|
+ } else
|
|
|
return JsonService::fail('暂无此方法');
|
|
|
- }catch (\Exception $e){
|
|
|
- return JsonService::fail('获取推广二维码失败,请检查您的微信配置',['line'=>$e->getLine(),'messag'=>$e->getMessage()]);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ return JsonService::fail('获取推广二维码失败,请检查您的微信配置', ['line' => $e->getLine(), 'messag' => $e->getMessage()]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -206,18 +210,18 @@ class AgentManage extends AuthController
|
|
|
public function routine_code($uid)
|
|
|
{
|
|
|
$userInfo = User::getUserInfos($uid);
|
|
|
- $name = $userInfo['uid'].'_'.$userInfo['is_promoter'].'_user.jpg';
|
|
|
- $imageInfo = SystemAttachment::getInfo($name,'name');
|
|
|
- if(!$imageInfo){
|
|
|
+ $name = $userInfo['uid'] . '_' . $userInfo['is_promoter'] . '_user.jpg';
|
|
|
+ $imageInfo = SystemAttachment::getInfo($name, 'name');
|
|
|
+ if (!$imageInfo) {
|
|
|
$res = \app\models\routine\RoutineCode::getShareCode($uid, 'spread', '', '');
|
|
|
- if(!$res) throw new \think\Exception('二维码生成失败');
|
|
|
- $imageInfo = UploadService::instance()->setUploadPath('routine/spread/code')->imageStream($name,$res['res']);
|
|
|
- if(!is_array($imageInfo)) return $imageInfo;
|
|
|
- SystemAttachment::attachmentAdd($imageInfo['name'],$imageInfo['size'],$imageInfo['type'],$imageInfo['dir'],$imageInfo['thumb_path'],1,$imageInfo['image_type'],$imageInfo['time']);
|
|
|
- RoutineQrcode::setRoutineQrcodeFind($res['id'],['status'=>1,'time'=>time(),'qrcode_url'=>$imageInfo['dir']]);
|
|
|
+ if (!$res) throw new \think\Exception('二维码生成失败');
|
|
|
+ $imageInfo = UploadService::instance()->setUploadPath('routine/spread/code')->imageStream($name, $res['res']);
|
|
|
+ if (!is_array($imageInfo)) return $imageInfo;
|
|
|
+ SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time']);
|
|
|
+ RoutineQrcode::setRoutineQrcodeFind($res['id'], ['status' => 1, 'time' => time(), 'qrcode_url' => $imageInfo['dir']]);
|
|
|
$urlCode = $imageInfo['dir'];
|
|
|
- }else $urlCode = $imageInfo['att_dir'];
|
|
|
- return ['code_src'=>$urlCode];
|
|
|
+ } else $urlCode = $imageInfo['att_dir'];
|
|
|
+ return ['code_src' => $urlCode];
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
@@ -225,9 +229,9 @@ class AgentManage extends AuthController
|
|
|
* */
|
|
|
public function wechant_code($uid)
|
|
|
{
|
|
|
- $qr_code = \crmeb\services\QrcodeService::getForeverQrcode('spread',$uid);
|
|
|
- if(isset($qr_code['url']))
|
|
|
- return ['code_src'=>$qr_code['url']];
|
|
|
+ $qr_code = \crmeb\services\QrcodeService::getForeverQrcode('spread', $uid);
|
|
|
+ if (isset($qr_code['url']))
|
|
|
+ return ['code_src' => $qr_code['url']];
|
|
|
else
|
|
|
throw new \think\Exception('获取失败,请稍后再试!');
|
|
|
}
|
|
|
@@ -238,63 +242,66 @@ class AgentManage extends AuthController
|
|
|
*/
|
|
|
public function look_xcx_code($uid = '')
|
|
|
{
|
|
|
- if(!strlen(trim($uid))) return JsonService::fail('缺少参数');
|
|
|
- try{
|
|
|
+ if (!strlen(trim($uid))) return JsonService::fail('缺少参数');
|
|
|
+ try {
|
|
|
$userInfo = User::getUserInfos($uid);
|
|
|
- $name = $userInfo['uid'].'_'.$userInfo['is_promoter'].'_user.jpg';
|
|
|
- $imageInfo = SystemAttachment::getInfo($name,'name');
|
|
|
- if(!$imageInfo){
|
|
|
+ $name = $userInfo['uid'] . '_' . $userInfo['is_promoter'] . '_user.jpg';
|
|
|
+ $imageInfo = SystemAttachment::getInfo($name, 'name');
|
|
|
+ if (!$imageInfo) {
|
|
|
$res = \app\models\routine\RoutineCode::getShareCode($uid, 'spread', '', '');
|
|
|
- if(!$res) return JsonService::fail('二维码生成失败');
|
|
|
- $imageInfo = UploadService::instance()->setUploadPath('routine/spread/code')->imageStream($name,$res['res']);
|
|
|
- if(!is_array($imageInfo)) return JsonService::fail($imageInfo);
|
|
|
- SystemAttachment::attachmentAdd($imageInfo['name'],$imageInfo['size'],$imageInfo['type'],$imageInfo['dir'],$imageInfo['thumb_path'],1,$imageInfo['image_type'],$imageInfo['time']);
|
|
|
- RoutineQrcode::setRoutineQrcodeFind($res['id'],['status'=>1,'time'=>time(),'qrcode_url'=>$imageInfo['dir']]);
|
|
|
+ if (!$res) return JsonService::fail('二维码生成失败');
|
|
|
+ $imageInfo = UploadService::instance()->setUploadPath('routine/spread/code')->imageStream($name, $res['res']);
|
|
|
+ if (!is_array($imageInfo)) return JsonService::fail($imageInfo);
|
|
|
+ SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time']);
|
|
|
+ RoutineQrcode::setRoutineQrcodeFind($res['id'], ['status' => 1, 'time' => time(), 'qrcode_url' => $imageInfo['dir']]);
|
|
|
$urlCode = $imageInfo['dir'];
|
|
|
- }else $urlCode = $imageInfo['att_dir'];
|
|
|
- return JsonService::successful(['code_src'=>$urlCode]);
|
|
|
- }catch (\Exception $e){
|
|
|
- return JsonService::fail('查看推广二维码失败!',['line'=>$e->getLine(),'meassge'=>$e->getMessage()]);
|
|
|
+ } else $urlCode = $imageInfo['att_dir'];
|
|
|
+ return JsonService::successful(['code_src' => $urlCode]);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ return JsonService::fail('查看推广二维码失败!', ['line' => $e->getLine(), 'meassge' => $e->getMessage()]);
|
|
|
}
|
|
|
}
|
|
|
- /*
|
|
|
+
|
|
|
+ /**
|
|
|
* 解除单个用户的推广权限
|
|
|
* @param int $uid
|
|
|
- * */
|
|
|
- public function delete_spread($uid=0)
|
|
|
+ */
|
|
|
+ public function delete_spread($uid = 0)
|
|
|
{
|
|
|
- if(!$uid) return JsonService::fail('缺少参数');
|
|
|
- if(User::where('uid',$uid)->update(['is_promoter'=>0]))
|
|
|
+ if (!$uid) return JsonService::fail('缺少参数');
|
|
|
+ if (User::where('uid', $uid)->update(['is_promoter' => 0]))
|
|
|
return JsonService::successful('解除成功');
|
|
|
else
|
|
|
return JsonService::fail('解除失败');
|
|
|
}
|
|
|
|
|
|
- /*
|
|
|
+ /**
|
|
|
* 清除推广人
|
|
|
- * */
|
|
|
- public function empty_spread($uid=0)
|
|
|
+ */
|
|
|
+ public function empty_spread($uid = 0)
|
|
|
{
|
|
|
- if(!$uid) return JsonService::fail('缺少参数');
|
|
|
- $res = User::where('uid',$uid)->update(['spread_uid'=>0]);
|
|
|
- if($res)
|
|
|
+ if (!$uid) return JsonService::fail('缺少参数');
|
|
|
+ $res = User::where('uid', $uid)->update(['spread_uid' => 0]);
|
|
|
+ if ($res)
|
|
|
return JsonService::successful('清除成功');
|
|
|
else
|
|
|
return JsonService::fail('清除失败');
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 个人资金详情页面
|
|
|
* @return mixed
|
|
|
*/
|
|
|
- public function now_money($uid = ''){
|
|
|
- if($uid == '') return $this->failed('参数错误');
|
|
|
- $list = UserBill::where('uid',$uid)->where('category','now_money')
|
|
|
+ public function now_money($uid = '')
|
|
|
+ {
|
|
|
+ if ($uid == '') return $this->failed('参数错误');
|
|
|
+ $list = UserBill::where('uid', $uid)->where('category', 'now_money')
|
|
|
->field('mark,pm,number,add_time')
|
|
|
- ->where('status',1)->order('add_time DESC')->select()->toArray();
|
|
|
- foreach ($list as &$v){
|
|
|
- $v['add_time'] = date('Y-m-d H:i:s',$v['add_time']);
|
|
|
+ ->where('status', 1)->order('add_time DESC')->select()->toArray();
|
|
|
+ foreach ($list as &$v) {
|
|
|
+ $v['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
|
|
|
}
|
|
|
- $this->assign('list',$list);
|
|
|
+ $this->assign('list', $list);
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
|