123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520 |
- <?php
- namespace Option\Lib;
- use Dever;
- class Account
- {
- public function getIdcard($id)
- {
- if ($id < 0) {
- return '无';
- }
- $account = Dever::db('option/account')->find($id);
- if ($account && $account['is_idcard'] == 1) {
- $html = '';
- $table = array();
- if ($account['idcard_front']) {
- $account['idcard_front'] = Dever::load('upload/view')->get($account['idcard_front'], 't', 1);
- $account['idcard_back'] = Dever::load('upload/view')->get($account['idcard_back'], 't', 1);
- $table['<img src="'.$account['idcard_front'].'" width="100">'] = '<img src="'.$account['idcard_back'].'" width="100">';
- }
- $html .= Dever::table($table);
- return $html;
- } else {
- return '未上传';
- }
- }
- public function getInfo($id)
- {
- if ($id < 0) {
- return '无';
- }
- $account = Dever::db('option/account')->find($id);
- if ($account) {
- return Dever::load('option/lib/member')->getInfo($account['mid']);
- } else {
- return '';
- }
- }
- public function getEmail($id)
- {
- if ($id < 0) {
- return '无';
- }
- $account = Dever::db('option/account')->find($id);
- if ($account) {
- $string = $account['email'];
- if ($string) {
- $string .= '<br />';
- }
- if ($account['is_email'] == 1) {
- $string .= '<font style="color:blue">已验证</font>';
- } else {
- $string .= '<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 '';
- }
- }
- public function getAgreementStatus($id, $table = 'option/agreement')
- {
- if ($id < 0) {
- return '无';
- }
- $audit = Dever::db($table)->config['audit'];
- $agreement = Dever::db($table)->find(array('aid' => $id));
- if ($agreement) {
- $string = $audit[$agreement['audit']];
- if ($agreement['audit'] == 4) {
- $string .= '<br />原因:' . $agreement['audit_desc'];
- }
- if ($agreement['audit_date']) {
- $audit_date = date('Y-m-d H:i:s', $agreement['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');
- $mid = Dever::input('mid');
- if ($mid) {
- $member = Dever::db('option/member')->one(array('id' => $mid, 'clear_top' => true));
- $aid = $member['aid'];
- }
-
- $account = Dever::db('option/account')->one($aid);
- if (!$mid) {
- $member = Dever::db('option/member')->one(array('id' => $account['mid'], 'clear_top' => true));
- }
- $config = Dever::db('option/account')->config['set'];
- $member_config = Dever::db('option/member')->config['set'];
- $result['账户信息'] = $this->getMemberInfo($member, $member_config);
- $search_auth = Dever::input('search_auth');
- $option_aid = $aid;
- if ($search_auth) {
- $option_aid .= '&search_auth=' . $search_auth;
- }
- if ($member['main'] == 1) {
- $idcard_front = $idcard_back = '';
- if ($account['idcard_front']) {
- $idcard_front = '<a href="'.$account['idcard_front'].'" target="_blank"><img src="'.$account['idcard_front'].'" width="150" /></a>';
- }
-
- if ($account['idcard_back']) {
- $idcard_back = ' <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']].')';
- }
- $table = array();
- $table['head'] = array('账户状态', '审核状态', '邮箱认证', '身份证正面', '身份证反面');
- $table['body'] = array();
- $table['body'][] = array
- (
- $config['status'][$account['status']],
- $config['audit'][$account['audit']],
- $account['email'],
- $idcard_front,
- $idcard_back,
- );
- $result['审核信息'] = array
- (
- 'type' => 'table',
- 'content' => $table,
- );
- # 获取账户资金
- $cash_type = Dever::load('option/lib/manage')->getQiquan($member['company_id']);
- $cash = Dever::db('option/cash')->getTotal(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']]['name'],
- $v['daijiaofu'],
- //$total,
- $v['jiaofu'],
- $v['zuofei'],
- $v['fafang'],
- //$v['jiaofu'],
- $v['duifu'],
- );
- }
- $result['账户金额'] = array
- (
- 'type' => 'table',
- 'content' => $table,
- );
- }
- }
-
- $button = array();
- $button[0]['btn'][] = array
- (
- 'type' => 'edit',
- 'link' => Dever::url('project/database/update?project=option&table=member&where_id='.$mid.'&status=1&col=name,idcard', 'manage'),
- 'name' => '修改资料',
- );
- $button[0]['btn'][] = array
- (
- 'type' => 'edit',
- 'link' => Dever::url('project/database/update?project=option&table=account&where_id='.$aid.'&status=1&col=email,send_email', 'manage'),
- 'name' => '修改邮箱',
- );
- $url = '';
- if ($account['audit'] == 2) {
- $button[0]['btn'][] = array
- (
- 'type' => 'edit',
- 'link' => Dever::url('project/database/update?project=option&table=account&where_id='.$aid.'&status=1&col=audit,audit_desc', 'manage'),
- 'name' => '审核',
- );
- }
- if ($account['status'] == 3) {
- $button[0]['btn'][] = array
- (
- 'type' => 'action',
- 'link' => Dever::url('lib/account.setStatus?id=' . $aid . '&value=2', 'option'),
- 'name' => '恢复账号',
- );
- } elseif ($account['status'] == 2) {
- $button[0]['btn'][] = array
- (
- 'type' => 'action',
- 'link' => Dever::url('lib/account.setStatus?id=' . $aid . '&value=3', 'option'),
- 'name' => '禁用账号',
- );
- }
- $button[0]['btn'][] = array
- (
- 'type' => 'link',
- 'link' => Dever::url('project/database/list?project=option&table=agreement&search_option_aid='.$option_aid.'', 'manage'),
- 'name' => '期权合同',
- );
-
- // $button[0]['btn'][] = array
- // (
- // 'type' => 'edit',
- // 'link' => Dever::url('project/database/update?project=option&table=push_cash&search_option_mid='.$mid.'&search_option_aid='.$option_aid . '&type=1', 'manage'),
- // 'name' => '期权价值交付',
- // );
- // $button[0]['btn'][] = array
- // (
- // 'type' => 'edit',
- // 'link' => Dever::url('project/database/update?project=option&table=push_cash&search_option_mid='.$mid.'&search_option_aid='.$option_aid . '&type=2', 'manage'),
- // 'name' => '期权价值发放',
- // );
- // '"member&search_option_aid={id}&search_option_dever_auth='.$search_auth.'"'
- $button[0]['btn'][] = array
- (
- 'type' => 'link',
- 'link' => Dever::url('project/database/list&project=option&search_option_dever_auth=2&page_type=2&table=member&search_option_aid='.$option_aid.'&search_option_dever_auth=2&menu=option&menu_id=290&search_option_state=1', 'manage'),
- 'name' => '账户列表',
- );
- $button[1]['btn'][] = array
- (
- 'type' => 'link',
- 'link' => Dever::url('project/database/list?project=option&table=bill_jiaofu&search_option_aid='.$option_aid.'', 'manage'),
- 'name' => '期权交付记录',
- );
- $button[1]['btn'][] = array
- (
- 'type' => 'link',
- 'link' => Dever::url('project/database/list?project=option&table=bill_zuofei&search_option_aid='.$option_aid.'', 'manage'),
- 'name' => '期权作废记录',
- );
- $button[1]['btn'][] = array
- (
- 'type' => 'link',
- 'link' => Dever::url('project/database/list?project=option&table=bill_fafang&search_option_aid='.$option_aid.'', 'manage'),
- 'name' => '期权发放记录',
- );
- $button[1]['btn'][] = array
- (
- 'type' => 'link',
- 'link' => Dever::url('project/database/list?project=option&table=bill_duifu&search_option_aid='.$option_aid.'', 'manage'),
- 'name' => '期权兑付记录',
- );
-
- if ($search_auth == -1) {
- $url = Dever::url('project/database/list?project=option&table=member&search_option_main=2&search_option_aid=' . $aid, 'manage');
- } else {
- $url = Dever::url('project/database/list?project=option&table=account', 'manage');
- if ($search_auth) {
- $url .= '&search_option_dever_auth=' . $search_auth;
- }
- }
- if (Dever::load('manage/auth')->checkFunc('menu_279.menu_290','setmessage','发送短信')) {
- $table = 'template';
- $res = Dever::load('sms/api')->getTable($table);
- $button[1]['btn'][] = array
- (
- 'type' => 'edit',
- 'link' => Dever::url($res.'&search_option_state=1&search_option_type=qiquan_reg_yes,qiquan_reg_no,qiquan_audit,qiquan_hetong_no&search_option_name='.$member['name'].'&search_option_mobile='.$member['mobile'], 'manage'),
- 'name' => '发送短信',
- );
- }
- // $head_btn[] = array
- // (
- // 'type' => 'link',
- // 'link' => $url,
- // 'name' => '返回上一页',
- // );
- $head = array
- (
- 'name' => '基本信息',
- 'btn' => array(),
- );
- $foot = $button;
- $html = Dever::show($head, $result, $foot);
- return $html;
- }
- private function getMemberInfo($member, $member_config)
- {
- $result = array();
- $company = Dever::db('manage/company')->one($member['company_id']);
- $result = array
- (
- 'type' => 'info',
- 'content' => array
- (
- array
- (
- array('账户类型', $member_config['main'][$member['main']]),
- array('账户索引', $member['key']),
- array('所属公司', $company['name']),
- ),
- array
- (
- array('姓名', $member['name']),
- array('手机号', $member['mobile']),
- array('身份证号', $member['idcard']),
- ),
- ),
- );
- 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';
- }
- public function daijiaofu($id)
- {
- $where['aid'] = $id;
- $total = Dever::db('option/bill_jiaofu')->total($where);
- $html = $total . '条';
- $cash = Dever::db('option/cash')->getTotal(array('aid' => $id));
- $total = 0;
- if ($cash) {
- foreach ($cash as $k => $v) {
- $total += $v['daijiaofu'];
- }
- }
- $html .= '<br/ >' . number_format($total, 2, '.', '');
- return $html;
- }
- public function getCash($id)
- {
- $where['aid'] = $id;
- $where['status'] = 2;
- $total = Dever::db('option/bill_jiaofu')->total($where);
- $daijiaofu = $total . '条';
- $daijiaofu_qiquan = 0;
- $daijiaofu_yuanshiqiquan = 0;
- $cash = Dever::db('option/cash')->getTotal(array('aid' => $id, 'status' => 2));
- $total = 0;
- $qiquan = '';
- $yuanshiqiquan = '';
- if ($cash) {
- foreach ($cash as $k => $v) {
- $v['total'] = number_format($v['jiaofu'] + $v['fafang'] + $v['duifu'], 2, '.', '');
- $total += $v['daijiaofu'];
- if ($v['type'] == 1) {
- $daijiaofu_qiquan += $v['daijiaofu'];
- $qiquan .= $v['total'];
- $qiquan .= '<br/ >发放' . $v['fafang'];
- $qiquan .= '<br/ >未发' . $v['jiaofu'];
- $qiquan .= '<br/ >兑付' . $v['duifu'];
- } elseif ($v['type'] == 2) {
- $daijiaofu_yuanshiqiquan += $v['daijiaofu'];
- $yuanshiqiquan .= $v['total'];
- $yuanshiqiquan .= '<br/ >发放' . $v['fafang'];
- $yuanshiqiquan .= '<br/ >未发' . $v['jiaofu'];
- $yuanshiqiquan .= '<br/ >兑付' . $v['duifu'];
- }
- }
- }
- $daijiaofu .= '<br/ >' . number_format($daijiaofu_qiquan, 2, '.', '') . '<br/ >' . number_format($daijiaofu_yuanshiqiquan, 2, '.', '');
- if (!$qiquan) {
- $qiquan = '无';
- }
- if (!$yuanshiqiquan) {
- $yuanshiqiquan = '无';
- }
- return array('daijiaofu' => $daijiaofu, 'qiquan' => $qiquan, 'yuanshiqiquan' => $yuanshiqiquan);
- }
- public function getCashInfo($id, $mid)
- {
- $table = array();
- $table['head'] = array('账户类型', '待交付', '未发放', '已作废', '已发放', '已兑付');
- $table['body'] = array();
- $member = Dever::db('option/member')->find($mid);
- if ($member) {
- $cash = Dever::db('option/cash')->getTotal(array('aid' => $id, 'status' => 2));
- $qiquan = Dever::db('option/company_qiquan')->select(array('company_id' => $member['company_id']));
- if ($qiquan) {
- foreach ($qiquan as $k => $v) {
- if (isset($cash[$v['id']])) {
- $data = $cash[$v['id']];
- $table['body'][$k] = array
- (
- $v['name'], $data['daijiaofu'], $data['jiaofu'], $data['zuofei'], $data['fafang'], $data['duifu']
- );
- }
- }
- }
- }
- $body[''] = array
- (
- 'type' => 'table',
- 'content' => $table,
- );
- if ($table['body']) {
- return Dever::show('', $body);
- } else {
- return '暂无';
- }
- }
- public function send_sms($mid){
- $member = Dever::db('option/member')->one($mid);
- $table = 'template';
- $res = Dever::load('sms/api')->getTable($table);
- return Dever::url($res.'&search_option_state=1&search_option_type=qiquan_reg_yes,qiquan_reg_no,qiquan_audit,qiquan_hetong_no&search_option_name='.$member['name'].'&search_option_mobile='.$member['mobile'], 'manage');
-
- }
- }
|