1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace Active\Lib;
- use Dever;
- class User
- {
- # 获取代理商信息
- public function agent($user, $type = 'mobile')
- {
- if ($user && $user[$type]) {
- $col = $type;
- if ($type == 'mid') {
- $col = 'id';
- }
- $member = Dever::db('agent/member')->find(array($col => $user[$type], 'status' => 2));
- if ($member) {
- return $member;
- }
- }
- return array();
- }
- #获取代理商信息更新user
- public function upUser($mobile,$data){
- $member = Dever::load('active/lib/user')->agent(array('mobile' => $mobile));
- if ($member) {
- $insert['name'] = $member['name'];
- $insert['mobile'] = $member['mobile'];
- $insert['idcard'] = $member['idcard'];
- $insert['pass'] = $member['password'];
- $insert['old_pwd'] = $member['old_pwd'];
- $insert['old_salt'] = $member['old_salt'];
- $uid = Dever::db('active/user')->insert($insert);
- } else {
- $uid = Dever::db('active/user')->insert($data);
- }
- return $uid;
- }
- }
|