|
|
@@ -13,13 +13,13 @@ class CoinController extends BaseServices |
|
|
|
public function adminindex(Request $request) |
|
|
|
{ |
|
|
|
[$page, $limit] = $this->getPageValue(); |
|
|
|
$page = $page - 1; |
|
|
|
$page = $page * $limit; |
|
|
|
$limit = (empty($limit)) ? 12 : $limit; |
|
|
|
$User = new \app\model\user\User(); |
|
|
|
$CoinLog = new CoinLog(); |
|
|
|
$uid = $request->param('uid', 0); |
|
|
|
$where['c.source_uid'] = $uid; |
|
|
|
$result = $CoinLog->alias('c')->join($User->getTable() . ' u', 'c.uid = u.uid')->where($where)->limit($page, $limit)->field('c.*,u.nickname,u.avatar')->select()->toArray(); |
|
|
|
$where1['c.uid'] = $uid; |
|
|
|
$where2['c.source_uid'] = $uid; |
|
|
|
$result = $CoinLog->alias('c')->join($User->getTable() . ' u', 'c.uid = u.uid')->with(['getUserOneData'])->whereOr($where1)->whereOr($where2)->field('c.*,u.nickname,u.avatar')->select()->toArray(); |
|
|
|
foreach ($result as $k => $v) { |
|
|
|
//:0=增加,1=增加(下级购买商品返),2=减少(商品抵扣),3=减少(微信用户转让出去),4=增加(微信用户接收转让),5=增加(取消转让),6=减少(后台转让出去),7=增加(后台接收转让) |
|
|
|
switch ($v['type']) { |
|
|
@@ -45,13 +45,26 @@ class CoinController extends BaseServices |
|
|
|
$result[$k]['type'] = '增加(后台接收转让)'; |
|
|
|
break; |
|
|
|
case 7: |
|
|
|
$result[$k]['type'] = '减少(后台转让出去)'; |
|
|
|
if ($v['source_uid'] != $uid) { |
|
|
|
$result[$k]['type'] = '增加(后台接收转让)'; |
|
|
|
} else { |
|
|
|
$result[$k]['type'] = '减少(后台转让出去)'; |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
if ($v['source_uid'] != $uid) { |
|
|
|
$result[$k]['avatar'] = $result[$k]['avatar2']; |
|
|
|
$result[$k]['nickname'] = $result[$k]['nickname2']; |
|
|
|
$result[$k]['uid'] = $result[$k]['source_uid']; |
|
|
|
} |
|
|
|
if (!$result[$k]['uid']) { |
|
|
|
unset($result[$k]); |
|
|
|
} |
|
|
|
} |
|
|
|
$total = $CoinLog->alias('c')->join($User->getTable() . ' u', 'c.uid = u.uid')->where($where)->count(); |
|
|
|
$res['data'] = $result; |
|
|
|
$res['total'] = $total; |
|
|
|
$result = array_values($result); |
|
|
|
$result1 = array_slice($result, ($page - 1) * $limit, $limit); |
|
|
|
$res['data'] = $result1; |
|
|
|
$res['total'] = count($result); |
|
|
|
$res['status'] = 200; |
|
|
|
$res['msg'] = ''; |
|
|
|
return $res; |