|  | @@ -38,6 +38,8 @@ class Info
 | 
	
		
			
				|  |  |                  'col' => $project['source_name'],
 | 
	
		
			
				|  |  |                  'result' => 'id',
 | 
	
		
			
				|  |  |                  'search' => 'uid',
 | 
	
		
			
				|  |  | +                'project_name' => $project['name'],
 | 
	
		
			
				|  |  | +                'name' => $info['name'],
 | 
	
		
			
				|  |  |              );
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          
 | 
	
	
		
			
				|  | @@ -45,29 +47,29 @@ class Info
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      # 入账
 | 
	
		
			
				|  |  | -    public function up_commit($uid, $cash, $type, $config, $desc = '', $source = '', $source_id = '', $method = 1)
 | 
	
		
			
				|  |  | +    public function up_commit($uid, $cash, $type, $config, $desc = '', $source = '', $source_id = '', $method = 1, $state = true)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          if ($cash == 0) {
 | 
	
		
			
				|  |  | -            Dever::alert('金额不能为0');
 | 
	
		
			
				|  |  | +            return $this->alert('金额不能为0', $state);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  |          $config = Dever::db('account/config')->find(array('key' => $config));
 | 
	
		
			
				|  |  |          if (!$config) {
 | 
	
		
			
				|  |  | -            Dever::alert('账户信息不存在');
 | 
	
		
			
				|  |  | +            return $this->alert('账户信息不存在', $state);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          $project = Dever::db('account/config_project')->find($config['project_id']);
 | 
	
		
			
				|  |  |          $user = Dever::db($project['source'])->find($uid);
 | 
	
		
			
				|  |  |          if (!$user) {
 | 
	
		
			
				|  |  | -            Dever::alert('用户信息不存在');
 | 
	
		
			
				|  |  | +            return $this->alert('用户信息不存在', $state);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          $type = Dever::db('account/config_type')->find(array('key' => $type));
 | 
	
		
			
				|  |  |          if (!$type) {
 | 
	
		
			
				|  |  | -            Dever::alert('交易类型不存在');
 | 
	
		
			
				|  |  | +            return $this->alert('交易类型不存在', $state);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          if ($type['project_id'] != -1 && $type['project_id'] != $config['project_id']) {
 | 
	
		
			
				|  |  | -            Dever::alert('交易类型不正确');
 | 
	
		
			
				|  |  | +            return $this->alert('交易类型不正确', $state);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          $data['uid'] = $uid;
 | 
	
	
		
			
				|  | @@ -78,23 +80,23 @@ class Info
 | 
	
		
			
				|  |  |          if (!$info) {
 | 
	
		
			
				|  |  |              $info['id'] = Dever::db('account/info')->insert($data);
 | 
	
		
			
				|  |  |              if (!$info['id']) {
 | 
	
		
			
				|  |  | -                Dever::alert('用户信息不存在');
 | 
	
		
			
				|  |  | +                return $this->alert('用户信息不存在', $state);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              $info['cash'] = 0;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if ($type['key'] == 'tixian') {
 | 
	
		
			
				|  |  |              if ($config['is_withdraw'] == 2) {
 | 
	
		
			
				|  |  | -                Dever::alert('当前账户不能提现');
 | 
	
		
			
				|  |  | +                return $this->alert('当前账户不能提现', $state);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              if ($config['withdraw_down'] > 0 && $cash < $config['withdraw_down']) {
 | 
	
		
			
				|  |  | -                Dever::alert('提现金额不能少于' . $config['withdraw_down']);
 | 
	
		
			
				|  |  | +                return $this->alert('提现金额不能少于' . $config['withdraw_down'], $state);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              if ($config['withdraw_up'] > 0 && $cash > $config['withdraw_up']) {
 | 
	
		
			
				|  |  | -                Dever::alert('提现金额不能大于' . $config['withdraw_up']);
 | 
	
		
			
				|  |  | +                return $this->alert('提现金额不能大于' . $config['withdraw_up'], $state);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              if ($cash > $info['cash']) {
 | 
	
		
			
				|  |  | -                Dever::alert('提现金额不能大于账户余额');
 | 
	
		
			
				|  |  | +                return $this->alert('提现金额不能大于账户余额', $state);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -103,7 +105,7 @@ class Info
 | 
	
		
			
				|  |  |              $cash = -1*$cash;
 | 
	
		
			
				|  |  |              $func = 'dec';
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +        $data['info_id'] = $info['id'];
 | 
	
		
			
				|  |  |          $data['cash'] = $cash;
 | 
	
		
			
				|  |  |          $data['type_id'] = $type['id'];
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -147,4 +149,12 @@ class Info
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return $yue;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private function alert($msg, $state = true)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if ($state) {
 | 
	
		
			
				|  |  | +            return Dever::alert($msg);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return -1;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |