| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 | 
							- <?php
 
- namespace Option\Lib;
 
- use Dever;
 
- class Account
 
- {
 
-     public function getInfo($id, $table = 'option/account')
 
-     {
 
-         if ($id < 0) {
 
-             return '无';
 
-         }
 
-         $account = Dever::db($table)->find($id);
 
-         if ($account) {
 
-             $string = $account['name'] . '<br />' . $account['mobile'] . '<br />' . $account['idcard'] . '<br />' . $account['email'];
 
-             if ($account['is_email'] == 1) {
 
-                 $string .= '<br /><font style="color:blue">邮箱已验证</font>';
 
-             } else {
 
-                 $string .= '<br /><font style="color:red">邮箱未验证</font>';
 
-             }
 
-             return $string;
 
-             
 
-         } else {
 
-             return '';
 
-         }
 
-     }
 
-     public function getAudit($id, $table = 'option/account')
 
-     {
 
-         if ($id < 0) {
 
-             return '无';
 
-         }
 
-         $audit = Dever::db($table)->config['set']['audit'];
 
-         $account = Dever::db($table)->find($id);
 
-         if ($account) {
 
-             $string = $audit[$account['audit']];
 
-             if ($account['audit'] == 4) {
 
-                 $string .= '<br />原因:' . $account['audit_desc'];
 
-             }
 
-             if ($account['audit_date']) {
 
-                 $audit_date = date('Y-m-d H:i:s', $account['audit_date']);
 
-                 $string .= '<br />'.$audit_date;
 
-             }
 
-             return $string;
 
-             
 
-         } else {
 
-             return '';
 
-         }
 
-     }
 
-     /**
 
-      * 验证手机号
 
-      * @return mixed
 
-      */
 
-     public function checkMobile($mobile)
 
-     {
 
-         $rule = Dever::rule('mobile');
 
-         if (!$mobile) {
 
-             Dever::alert('手机号不能为空');
 
-         }
 
-         if (!preg_match($rule, $mobile)) {
 
-             Dever::alert('手机号码格式错误');
 
-         }
 
-         return $mobile;
 
-     }
 
-     /**
 
-      * 验证验证码
 
-      * @return mixed
 
-      */
 
-     public function checkMcode($mobile)
 
-     {
 
-         $code = Dever::input('mcode');
 
-         if (!$code) {
 
-             Dever::alert('请输入验证码');
 
-         }
 
-         $code = Dever::load('passport/reg')->mcode($mobile, $code, 1);
 
-         if (!$code) {
 
-             Dever::alert('验证码输入错误');
 
-         }
 
-     }
 
-     /**
 
-      * 查看详情
 
-      * @return mixed
 
-      */
 
-     public function show()
 
-     {
 
-         $aid = Dever::input('aid');
 
-         $account = Dever::db('option/account')->one($aid);
 
-         $config = Dever::db('option/account')->config['set'];
 
-         $result['账户信息'] = $this->getShowInfo($account, $config);
 
-         $button = array();
 
-         $button[0]['btn'][] = array
 
-         (
 
-             'type' => 'edit',
 
-             'link' => Dever::url('project/database/update?project=option&table=account&where_id='.$account['id'].'&status=1&col=name,idcard,idcard_front,idcard_back', 'manage'),
 
-             'name' => '修改认证资料',
 
-         );
 
-         $url = '';
 
-         if ($account['status'] == 3) {
 
-             $button[0]['btn'][] = array
 
-             (
 
-                 'type' => 'action',
 
-                 'link' => Dever::url('lib/account.setStatus?id=' . $account['id'] . '&value=2', 'option'),
 
-                 'name' => '恢复账号',
 
-             );
 
-         } elseif ($account['status'] == 2) {
 
-             $button[0]['btn'][] = array
 
-             (
 
-                 'type' => 'action',
 
-                 'link' => Dever::url('lib/account.setStatus?id=' . $account['id'] . '&value=3', 'option'),
 
-                 'name' => '禁用账号',
 
-             );
 
-         }
 
-         $aid = $account['id'];
 
-         if ($account['type'] == 1) {
 
-             # 给主账户发期权
 
-             $parent = Dever::db('option/account')->find(array('type' => 2, 'key' => $account['key']));
 
-             if ($parent) {
 
-                 $aid = $parent['id'];
 
-             } else {
 
-                 $aid = false;
 
-             }
 
-         }
 
-         # 获取账户资金
 
-         $cash_type = Dever::db('option/cash')->config['config_type'];
 
-         $cash = Dever::db('option/cash')->select(array('aid' => $aid));
 
-         if ($cash) {
 
-             $table = array();
 
-             $table['head'] = array('账户类型', '待交付', '已交付总额', '已发放剩余', '未发放', '已兑付');
 
-             $table['body'] = array();
 
-             foreach ($cash as $k => $v) {
 
-                 $total = number_format($v['jiaofu'] + $v['fafang'] + $v['duifu'], 2);
 
-                 //$weifafang = number_format($total-$v['fafang']-$v['duifu'], 2);
 
-                 $table['body'][] = array
 
-                 (
 
-                     $cash_type[$v['type']],
 
-                     $v['daijiaofu'],
 
-                     $total,
 
-                     //$v['jiaofu'],
 
-                     $v['fafang'],
 
-                     $v['jiaofu'],
 
-                     $v['duifu'],
 
-                 );
 
-             }
 
-             $result['账户金额'] = array
 
-             (
 
-                 'type' => 'table',
 
-                 'content' => $table,
 
-             );
 
-         }
 
-         if ($aid) {
 
-             $button[0]['btn'][] = array
 
-             (
 
-                 'type' => 'edit',
 
-                 'link' => Dever::url('project/database/update?project=option&table=push_cash&search_option_aid='.$aid, 'manage'),
 
-                 'name' => '发放期权',
 
-             );
 
-             $button[1]['btn'][] = array
 
-             (
 
-                 'type' => 'link',
 
-                 'link' => Dever::url('project/database/list?project=option&table=bill_jiaofu&search_option_aid='.$aid.'', 'manage'),
 
-                 'name' => '期权交付记录',
 
-             );
 
-             $button[1]['btn'][] = array
 
-             (
 
-                 'type' => 'link',
 
-                 'link' => Dever::url('project/database/list?project=option&table=bill_fafang&search_option_aid='.$aid.'', 'manage'),
 
-                 'name' => '期权发放记录',
 
-             );
 
-             $button[1]['btn'][] = array
 
-             (
 
-                 'type' => 'link',
 
-                 'link' => Dever::url('project/database/list?project=option&table=bill_duifu&search_option_aid='.$aid.'', 'manage'),
 
-                 'name' => '期权兑付记录',
 
-             ); 
 
-         }
 
-         $url = Dever::url('project/database/list?project=option&table=account', 'manage');
 
-         $head_btn[] = array
 
-         (
 
-             'type' => 'link',
 
-             'link' => $url,
 
-             'name' => '返回上一页',
 
-         );
 
-         $head = array
 
-         (
 
-             'name' => '基本信息',
 
-             'btn' => $head_btn,
 
-         );
 
-         $foot = $button;
 
-         $html = Dever::show($head, $result, $foot);
 
-         return $html;
 
-     }
 
-     private function getShowInfo($account, $config)
 
-     {
 
-         $result = array();
 
-         $idcard_pic = '';
 
-         if ($account['idcard_front']) {
 
-             $idcard_pic = '<a href="'.$account['idcard_front'].'" target="_blank"><img src="'.$account['idcard_front'].'" width="150" /></a>';
 
-         }
 
-         
 
-         if ($account['idcard_back']) {
 
-             $idcard_pic .= '  <a href="'.$account['idcard_back'].'" target="_blank"><img src="'.$account['idcard_back'].'" width="150" /></a>';
 
-         }
 
-         if ($account['email']) {
 
-             $account['email'] .= '('.$config['is_email'][$account['is_email']].')';
 
-         }
 
-         $result = array
 
-         (
 
-             'type' => 'info',
 
-             'content' => array
 
-             (
 
-                 array
 
-                 (
 
-                     array('姓名', $account['name']),
 
-                     array('手机号', $account['mobile']),
 
-                     array('邮箱', $account['email']),
 
-                 ),
 
-                 array
 
-                 (
 
-                     array('账户类型', $config['type'][$account['type']]),
 
-                     array('审核状态', $config['audit'][$account['audit']]),
 
-                     array('账户状态', $config['status'][$account['status']]),
 
-                 ),
 
-             ),
 
-         );
 
-         $result['content'][] = array
 
-         (
 
-             array('身份证号', $account['idcard']),
 
-             array('身份证照片', $idcard_pic),
 
-         );
 
-         return $result;
 
-     }
 
-     public function setStatus_api()
 
-     {
 
-         $where['where_id'] = Dever::input('id');
 
-         $where['status'] = Dever::input('value');
 
-         Dever::db('option/account')->update($where);
 
-         return 'reload';
 
-     }
 
- }
 
 
  |