1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use think\Db;
- use app\admin\model\shopro\user\WalletLog as UserWalletLogModel;
- class Userwallet extends Api
- {
- protected $noNeedLogin = [];
- protected $noNeedRight = ['*'];
-
- public function my_wallet(){
- $wallet['money'] = $this->auth->money;
- $this->success('success',$wallet);
- }
-
- public function my_money_log()
- {
- $tab = $this->request->param('type', 'all');
- $user = auth_user();
- $where = [
- 'user_id' => $user->id,
- 'type' => 'money',
- ];
- if($tab == 1){
- $where['amount'] = ['>', 0];
- }
- if($tab == 2){
- $where['amount'] = ['<', 0];
- }
- $logs = UserWalletLogModel::where($where)
- ->order('id', 'desc')
- ->autopage()->select();
- $this->success(1, $logs);
- }
-
-
- private function list_appen_logtext($list){
- if(!empty($list)){
- $conf = config('wallet.logtype');
- foreach($list as $key => $val){
- $list[$key]['log_text'] = isset($conf[$val['log_type']]) ? $conf[$val['log_type']] : '';
- }
- }
- return $list;
- }
- }
|