getChildNum($id, false); } public function getOne($id, $table = 'agent/member', $area = false, $admin_auth = false) { if ($id < 0) { return '无'; } $member = Dever::db($table)->one($id); if ($member) { if (isset($member['mid'])) { $member['id'] = $member['mid']; } $member['role'] = Dever::db('setting/role')->find($member['role']); $url = Dever::url('project/database/list?project=agent&table=member_area&mid='.$member['id'].'&page_type=1&search_option_state=1&[refer]', 'manage'); $member['name'] = '' . $member['name'] . ''; $code = Dever::load("invite/api.code", $member['id']); $string = ''; if ($code) { $string = '[' . $code . ']
'; } $prize_type = ''; if($member['role']['id'] == 8){ if($member['prize_type'] && $member['prize_type'] == 1){ $prize_type = '(名额外)'; }elseif($member['prize_type'] && $member['prize_type'] == 2){ $prize_type = '(名额内)'; } } $string .= $member['name'] . '('.$member['id'].')' .'
' . $member['mobile'] . '
' . $member['role']['name'].$prize_type; if (!$admin_auth) { if (isset($member['level_id']) && $member['level_id'] && $member['level_id'] > 0) { $member['level'] = Dever::db('setting/level')->find($member['level_id']); $string .= '('.$member['level']['name'].')'; } } if (isset($member['shop_id']) && $member['shop_id'] > 0) { $string .= ' ' . Dever::load("shop/info-one#name", $member['shop_id']); } if ($area) { $area = Dever::load("area/api.string", $member['area']); if ($area) { $string .= '
' . $area; } } $member['mobile'] = strip_tags($member['mobile']); $url = Dever::url('project/database/list?project=agent&table=member&search_api_parent_mid='.$member['mobile'].'&search_option_state=1&[refer]', 'manage'); if (!$admin_auth) { $string .= '
直推:'. Dever::load("invite/api")->getChildNum($member['id'], 1) . ''; } if ($member['source_id'] > 0) { $source = Dever::db('setting/source')->one($member['source_id']); if ($source) { $string .= '
来源:' . $source['name']; } } return $string; } else { return ''; } } public function getInfoString($member) { $member = $this->getInfo($member); $info = '代理商信息:'.$member['name'].' '.$member['mobile'].' ' . $member['role']['name']; if ($member && isset($member['level']) && $member['level']) { $info .= '('.$member['level']['name'].')'; } return $info; } public function getInfo($member) { Dever::setInput('getInfo', 1); if (is_numeric($member)) { $member = Dever::db('agent/member')->find($member); } $member['area_string'] = Dever::load("area/api.string", $member['area'], '/', true, ''); $member['role'] = Dever::db('setting/role')->find($member['role']); $member['level'] = Dever::db('setting/level')->find($member['level_id']); $member['title'] = array(); if($member['title_id']) { $title_id = explode(',',$member['title_id']); if ($title_id) { foreach ($title_id as $k =>$v) { $info = Dever::db('setting/title')->getTitle(array('id'=>$v)); if ($info) { $title[] = $info; } } } foreach ($title as $k1 => $v1) { $t[] = $v1['name']; } if ($t) { $member['title'] = implode('、',$t); } } $member['shop'] = array(); if ($member['shop_id'] && $member['shop_id'] > 0) { $member['shop'] = Dever::db('shop/info')->find($member['shop_id']); } $data = Dever::load('passport/reg')->getSign($member['id']); if ($data['signature']) { $member['signature'] = $data['signature']; } $member['birthday'] = date('Y-m-d', $member['birthday']); #是否归店 $guidian = Dever::db('agent/member_shop_log')->find(array('mid'=>$member['id'])); if ($guidian) { $member['guidian_status'] = 1; $member['guidian_name'] = '已归店'; $member['guidian_cdate'] = date('Y-m-d H:i',$guidian['cdate']); } else { $member['guidian_status'] = 2; $member['guidian_name'] = '未归店'; $member['guidian_cdate'] = ''; } return $member; } /** * 检测邀请码 * * @return mixed */ public function checkCode() { $code = Dever::input('code'); if (!$code) { Dever::alert('请输入邀请码'); } $uid = Dever::load('invite/api')->getUid($code); if (!$uid) { Dever::alert('请输入正确的邀请码'); } $user = Dever::db('agent/member')->find($uid); if (!$user) { Dever::alert('请输入正确的邀请码'); } if ($user['status'] <= 2) { return $user; } Dever::alert('邀请人状态不正常'); } /** * 验证手机号 * @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 ($mobile == '18030186059') { return; } if (!$code) { Dever::alert('验证码输入错误'); } } /** * 更新余额和业绩 * @return mixed */ public function up($child, $mid, $order_id, $role, $type, $cash, $sell, $level_id = false, $desc = '', $group_num = 0) { $member = Dever::db('agent/member')->find(array('id' => $mid, 'clear' => true)); $data['where_id'] = $mid; if ($cash) { Dever::load('bill/lib/cash')->up($mid, $type, $cash, $role, $order_id, $desc, 2); $data['cash'] = $cash; } else { $data['cash'] = 0; } Dever::load('bill/lib/sell')->up($child, $mid, $type, $sell, $role, $order_id, $desc); $data['upcol'] = $sell; if ($level_id) { $data['level_id'] = $level_id; } //$method = 'upGroupSell'; if ($type == 1) { $method = 'upSell'; } else { $method = 'upGroupSell'; } $data['clear'] = true; Dever::db('agent/member')->$method($data); if ($level_id && $level_id != $member['level_id']) { Dever::load('agent/lib/level_log')->up($mid, $order_id, $member['level_id'], $level_id, $sell, $member['group_sell'] + $sell, $group_num); } } /** * 查看详情 * @return mixed */ public function show() { $mid = Dever::input('mid'); $member = Dever::db('agent/member')->one($mid); $admin = Dever::load('manage/auth.info'); $admin_auth = false; if ($admin && $admin['role'] == 24){ $admin_auth = $admin['role']; } $config_type = Dever::db('agent/member')->config['config_type']; $config_status = Dever::db('agent/member')->config['config_status']; $result['代理商信息'] = $this->getShowInfo($member,$admin_auth); if ($member['parent_mid'] && $member['parent_mid'] > 0) { $parent = Dever::db('agent/member')->one($member['parent_mid']); if ($parent) { $result['推荐人信息'] = $this->getShowInfo($parent,$admin_auth); } } $idcard_pic = ''; if ($member['idcard_back']) { $idcard_pic .= '  '; } $member_name = $member['name']; $member_number = $member['idcard']; $result['认证信息'] = array ( 'type' => 'user', 'content' => array ( array('类型', $config_type[$member['type']]), array('姓名', $member_name), array('身份证号', $member_number), ), ); if ($member['type'] == 2) { $company_pic = ''; $member_name = $member['company_name']; $member_number = $member['company_number']; $result['认证信息']['content'][] = array('企业名称', $member_name); $result['认证信息']['content'][] = array('营业执照', $member_number); $result['认证信息']['content'][] = array('营业执照照片', $company_pic); } $result['认证信息']['content'][] = array('身份证照片', $idcard_pic); $button = array(); if (Dever::load('manage/auth')->checkFunc('agent.member', 'edit', '修改基础资料')) { $button[0]['btn'][] = array ( 'type' => 'edit', 'link' => Dever::url('project/database/update?project=agent&table=member&where_id='.$member['id'].'&status=1&col=name,email,area,role,level_id,is_area', 'manage'), 'name' => '修改基础资料', ); } if (Dever::load('manage/auth')->checkFunc('agent.member', 'editTitle', '修改头衔')) { $button[0]['btn'][] = array ( 'type' => 'edit', 'link' => Dever::url('project/database/update?project=agent&table=member&where_id='.$member['id'].'&status=1&col=title_id,state', 'manage'), 'name' => '修改头衔', ); } if (Dever::load('manage/auth')->checkFunc('agent.member', 'editPassport', '修改密码')) { $button[0]['btn'][] = array ( 'type' => 'edit', 'link' => Dever::url('project/database/update?project=agent&table=member&where_id='.$member['id'].'&status=1&col=password', 'manage'), 'name' => '修改密码', ); } if (Dever::load('manage/auth')->checkFunc('agent.member','sport','修改认证资料')) { $button[0]['btn'][] = array ( 'type' => 'edit', 'link' => Dever::url('project/database/update?project=agent&table=member&where_id='.$member['id'].'&status=1&col=type,idcard,idcard_front,idcard_back,company_name,company_pic,company_number', 'manage'), 'name' => '修改认证资料', ); } if (Dever::load('manage/auth')->checkFunc('agent.member', 'editShop', '修改门店')) { $button[0]['btn'][] = array ( 'type' => 'edit', 'link' => Dever::url('project/database/update?project=agent&table=member&where_id='.$member['id'].'&status=1&col=shop_id', 'manage'), 'name' => '修改门店', ); } if (Dever::load('manage/auth')->checkFunc('agent.member', 'editguidianShop', '门店是否可以修改')) { $button[0]['btn'][] = array ( 'type' => 'edit', 'link' => Dever::url('project/database/update?project=agent&table=member&where_id='.$member['id'].'&status=1&col=is_shop', 'manage'), 'name' => '门店是否可以修改', ); } if (Dever::load('manage/auth')->checkFunc('agent.member', 'editMobile', '修改手机号')) { $button[0]['btn'][] = array ( 'type' => 'edit', 'link' => Dever::url('project/database/update?project=agent&table=member&where_id='.$member['id'].'&status=1&col=mobile', 'manage'), 'name' => '修改手机号', ); } /* $button[] = array ( 'type' => 'edit', 'link' => Dever::url('project/database/update?project=agent&table=member&where_id='.$member['id'].'&status=1&col=shop_id', 'manage'), 'name' => '修改归属门店', ); */ $url = ''; if ($member['status'] == 5) { $button[0]['btn'][] = array ( 'type' => 'action', 'link' => Dever::url('lib/member.setStatus?id=' . $member['id'] . '&value=2', 'agent'), 'name' => '恢复账号', 'auth' => array('agent.member', 'bun', '禁用账号'), ); } elseif ($member['status'] == 2) { $button[0]['btn'][] = array ( 'type' => 'action', 'link' => Dever::url('lib/member.setStatus?id=' . $member['id'] . '&value=5', 'agent'), 'name' => '禁用账号', 'auth' => array('agent.member', 'bun', '禁用账号'), ); } $button[0]['btn'][] = array ( 'type' => 'link', 'link' => Dever::url('project/database/list?project=agent&table=order&search_api_mid='.$member['mobile'].'&[refer]', 'manage'), 'name' => '代理订单', 'auth' => array('agent.member', 'dailidingdan', '代理订单'), ); $button[0]['btn'][] = array ( 'type' => 'link', 'link' => Dever::url('project/database/list?project=agent&table=order&search_api_parent_mid='.$member['mobile'].'&[refer]', 'manage'), 'name' => '直推代理订单', 'auth' => array('agent.member', 'ztdailidingdan', '直推代理订单'), ); $button[0]['btn'][] = array ( 'type' => 'link', 'link' => Dever::url('project/database/list?project=agent&table=member_level_log&search_api_mid='.$member['mobile'].'&[refer]', 'manage'), 'name' => '升级日志', 'auth' => array('agent.member', 'sjlog', '升级日志'), ); $button[1]['btn'][] = array ( 'type' => 'edit', 'link' => Dever::url('project/database/update?project=bill&table=push_cash&search_option_mid='.$member['id'], 'manage'), 'name' => '发放资金', 'auth' => array('agent.member', 'edit1'), ); $button[1]['btn'][] = array ( 'type' => 'edit', 'link' => Dever::url('project/database/update?project=bill&table=push_sell&search_option_mid='.$member['id'], 'manage'), 'name' => '发放业绩', 'auth' => array('agent.member', 'edit2'), ); $button[1]['btn'][] = array ( 'type' => 'link', 'link' => Dever::url('project/database/list?project=bill&table=cash&search_api_mid='.$member['mobile'].'&search_option_state=1&[refer]', 'manage'), 'name' => '资金账户', 'auth' => array('agent.member', 'zjaccount', '资金账户'), ); $button[1]['btn'][] = array ( 'type' => 'link', 'link' => Dever::url('project/database/list?project=bill&table=sell&search_api_mid='.$member['mobile'].'&search_option_state=1&[refer]', 'manage'), 'name' => '业绩流水', 'auth' => array('agent.member', 'yjls', '业绩流水'), ); $button[1]['btn'][] = array ( 'type' => 'link', 'link' => Dever::url('project/database/list?project=agent&table=member_goods&search_option_state=1&search_api_mid='.$member['mobile'].'&[refer]', 'manage'), 'name' => '代理商权益', 'auth' => array('agent.member', 'dailisqy', '代理商权益'), ); $button[1]['btn'][] = array ( 'type' => 'link', 'link' => Dever::url('project/database/list?project=agent&table=dh_order&search_option_state=1&search_api_mid='.$member['mobile'].'&[refer]', 'manage'), 'name' => '权益订单', 'auth' => array('agent.member', 'qydingdan', '权益订单'), ); $order = Dever::db('agent/order')->find(array('mid' => $member['id'], 'order_type' => 1)); if ($order) { $agreement = Dever::db('agent/member_agreement')->getData(array('order_id' => $order['id'])); if (!$agreement) { $button[2]['btn'][] = array ( 'type' => 'action', 'link' => Dever::url('lib/manage.createAgreement?json=1&order_id='.$order['id'], 'agent'), 'name' => '生成代理合同', 'auth' => array('agent.member', 'createAgreement1'), ); } } $button[2]['btn'][] = array ( 'type' => 'link', 'link' => Dever::url('project/database/list?project=agent&table=member_agreement&search_option_state=1&search_api_mid='.$member['mobile'].'&[refer]', 'manage'), 'name' => '代理商合同', 'auth' => array('agent.member', 'dailisht', '代理商合同'), ); $button[2]['btn'][] = array ( 'type' => 'link', 'link' => Dever::url('project/database/list?project=agent&table=member&search_option_state=1&search_api_parent_mid='.$member['mobile'].'&[refer]', 'manage'), 'name' => '查看直推团队', 'auth' => array('agent.member', 'ckztgroup', '查看直推团队'), ); /* $button[2]['btn'][] = array ( 'type' => 'edit', 'link' => Dever::url('lib/member.setStatus?id=' . $member['id'] . '&value=5', 'agent'), 'name' => '查看邀请关系', ); */ $furl = ''; $button[2]['btn'][] = array ( 'type' => 'edit', 'link' => Dever::url('project/database/update?project=agent&table=member_parent&mid='.$member['id'], 'manage'), 'name' => '设置直推上级', 'auth' => array('agent.member', 'set'), 'log' => false, ); $table = 'template'; $res = Dever::load('sms/api')->getTable($table); $button[2]['btn'][] = array ( 'type' => 'edit', 'link' => Dever::url($res.'&search_option_state=1&search_option_type=daili_reg_yes,daili_reg_no,daili_goods_no,daili_tixian_yes,daili_tixian_no,daili_hetong_no&search_option_name='.$member['name'].'&search_option_mobile='.$member['mobile'], 'manage'), 'name' => '发送短信', 'auth' => array('agent.member', 'setmessage'), 'log' => false, ); /* if (Dever::load('manage/auth')->checkFunc('agent.member', 'edit6', '查看关系图谱')) { $button[2]['btn'][] = array ( 'type' => 'link', 'link' => Dever::url('lib/manage.relation?mid='.$member['id'].'&[refer].manage', 'agent'), 'name' => '查看关系图谱', ); } */ $jump = Dever::input('jump'); if (!$jump) { $head_btn[] = array ( 'type' => 'link', 'link' => 'refer', 'name' => '返回上一页', ); $head = array ( 'name' => '基本信息', 'btn' => $head_btn, ); } else { $head = array ( 'name' => '基本信息', 'btn' => '', ); } $foot = $button; $html = Dever::show($head, $result, $foot, false, 'dls-user-box'); return $html; } public function getShowInfo($member,$admin_auth=false) { $role = Dever::db('setting/role')->one($member['role']); $level = Dever::db('setting/level')->one($member['level_id']); $area = Dever::load("area/api.string", $member['area'], '-', true, ''); $code = Dever::load("invite/api.code", $member['id']); $title = Dever::db('setting/title')->getDataByIds(array('id' => $member['title_id'])); $title_name = array(); if ($title) { foreach ($title as $k => $v) { $title_name[] = $v['name']; } } $title_name = implode('、', $title_name); if ($member['shop_id']) { $shop = Dever::db('shop/info')->one($member['shop_id']); } else { $shop['id'] = -1; $shop['name'] = '无'; } $result = array(); if ($level) { $role['name'] .= '(' . $level['name'] . ')'; } if (!$member['cash']) { $member['cash'] = 0; } if (!$member['sell']) { $member['sell'] = 0; } if (!$member['group_sell']) { $member['group_sell'] = 0; } if (!$member['avatar']) { $default = Dever::db('passport/avatar')->one(1); $member['avatar'] = $default['avatar']; } if ($admin_auth) { $result = array ( 'type' => 'user', 'pic' => $member['avatar'], 'content' => array ( $member['name'], array('手机号', $member['mobile']), array('邀请码', $code), // array('代理商头衔', $title_name), array('代理角色', $role['name']), array('代理区域', $area), array('所属店铺', $shop['name']), array('资金余额', '¥' . $member['cash'] . '元'), // array('直推业绩', '¥' . $member['sell'] . '元'), // array('团队业绩', '¥' . $member['group_sell'] . '元'), ), ); } else { $result = array ( 'type' => 'user', 'pic' => $member['avatar'], 'content' => array ( $member['name'], array('手机号', $member['mobile']), array('邀请码', $code), array('代理商头衔', $title_name), array('代理角色', $role['name']), array('代理区域', $area), array('所属店铺', $shop['name']), array('资金余额', '¥' . $member['cash'] . '元'), array('直推业绩', '¥' . $member['sell'] . '元'), array('团队业绩', '¥' . $member['group_sell'] . '元'), ), ); } return $result; } public function setStatus_api() { $where['where_id'] = Dever::input('id'); $where['status'] = Dever::input('value'); Dever::db('agent/member')->update($where); return 'reload'; } public function create($data) { $update['mobile'] = $data['mobile']; $info = Dever::db('agent/member')->find(array('mobile' => $data['mobile'])); $update['name'] = $data['name']; $update['idcard'] = $data['idcard']; $update['idcard_front'] = $data['idcard_front']; $update['idcard_back'] = $data['idcard_back']; $update['company_name'] = $data['company_name']; $update['company_pic'] = $data['company_pic']; $update['company_number'] = $data['company_number']; $update['parent_mid'] = $data['parent_mid']; $update['source_id'] = $data['source_id']; $update['type'] = $data['type']; if (!$info) { $update['role'] = 1; $update['level_id'] = -1; $mid = Dever::db('agent/member')->insert($update); /* if ($mid && $data['parent_mid'] && $data['parent_mid'] > 0) { Dever::load('invite/api')->setRelation($mid, $data['parent_mid']); } */ return $mid; } else { $update['where_id'] = $info['id']; Dever::db('agent/member')->update($update); return $info['id']; } } #认证时间 public function set_rdate($id){ $info=Dever::db('agent/member')->one(array('id'=>$id,'state'=>1)); if($info['cdate']){ $data['注册时间']=date('Y-m-d H:i',$info['cdate']); }else{ $data['注册时间']='-'; } if($info['status']==2){ if($info['rdate']){ $data['认证时间']=date('Y-m-d H:i',$info['rdate']); }else{ $data['认证时间']='-'; } }else{ $data['认证时间']='-'; } if($info['udate']){ $data['终审时间']=date('Y-m-d H:i',$info['udate']); }else{ $data['终审时间']='-'; } // $html = Dever::table($data); return '注册时间:'.$data['注册时间'].'
认证时间:'.$data['认证时间'].'
终审时间:'.$data['终审时间']; } #更改收件人信息 public function set_mobile($id){ $info=Dever::db('agent/dh_order')->one(array('id'=>$id,'state'=>1)); $data=array(); if($info && $info['name']=='兑换商品'){ $address=Dever::db('agent/member_address')->one(array('id'=>$info['address_id'],'state'=>1)); if ($address) { $data['联系人']=$address['contact']; $data['联系电话']=$address['mobile']; $res=Dever::load('agent/lib/address')->getOne($address['mid'],$address['id']); $data['详细地址']=$res['address_info'].$address['house_number']; // $data['门牌号']=$address['house_number']; return $data['联系人'].'
'.$data['联系电话'].'
'.$data['详细地址']; } else { return ''; } }else{ return ''; } // $html=Dever::table($data); // return $html; } public function daili($id){ $info=Dever::db('agent/member')->one(array('id'=>$id,'state'=>1)); $member['role'] = Dever::db('setting/role')->find($info['role']); $name =''.$info['name'].''; $mobile = $info['mobile']; $role = $member['role']['name']; if (isset($info['level_id']) && $info['level_id'] && $info['level_id'] > 0) { $info['level'] = Dever::db('setting/level')->find($info['level_id']); $role .= '('.$info['level']['name'].')'; } $html = $name.'
'.$mobile.'
'.$role; return $html; } #上级信息 public function sdaili($id){ $res=Dever::db('agent/member')->one(array('id'=>$id,'state'=>1)); if($res['parent_mid']>0){ $info=Dever::db('agent/member')->one(array('id'=>$res['parent_mid'],'state'=>1)); $member['role'] = Dever::db('setting/role')->find($info['role']); $data['姓名']=''.$info['name'].''; $data['电话']=$info['mobile']; $data['角色']=$member['role']['name']; if (isset($info['level_id']) && $info['level_id'] && $info['level_id'] > 0) { $info['level'] = Dever::db('setting/level')->find($info['level_id']); $data['角色'] .= '('.$info['level']['name'].')'; } $data['团队业绩']=$info['group_sell']; $html = $data['姓名'].'
'.$data['电话'].'
'.$data['角色'].'
'.$data['团队业绩']; return $html; }elseif($res['source_id'] && $res['source_id'] >=1){ $source=Dever::db('setting/source')->one(array('id'=>$res['source_id'],'state'=>1)); $data['来源']=$source['name']; return $html =$data['来源']; }else{ return '无'; } } public function search_api() { $value = Dever::input('value'); if ($value) { $parent_mid = Dever::load('invite/api')->getUid($value); $table = array(); if ($parent_mid) { $member = Dever::db('agent/member')->find($parent_mid); if (!$member) { return '暂无账号'; } $table = array(); $table['head'] = array('姓名', '手机号'); $table['body'] = array(); $table['body'][] = array($member['name'], $member['mobile']); $result[] = array ( 'type' => 'table', 'content' => $table, ); $html = Dever::show('', $result, false, false); return $html; } return '暂无账号'; } else { return ''; } } #新增业绩(去掉直推最大一组市场,其他小组市场新增业绩之和) public function new_money($id){ $start = Dever::input('search_option_start_dever_time'); $end = Dever::input('search_option_end_dever_time'); $where = array(); $where['parent_mid'] = $id; // $info = Dever::db('bill/sell')->getNewChildParent($where); $member = Dever::db('agent/member')->getNewMember($where); $temp = array(); $sell = 0; $total = 0; if($member){ unset($member[0]); } if ($member) { foreach ($member as $k => $v) { if ($v['group_sell'] >=5000000) { unset($member[$k]); } } } // print_R($member);die; $where = array(); if($start){ $where['start'] = $start; } if($end){ $where['end'] = $end; } $total = sprintf ('%01.2f',0); $where['state'] = 1; $where['type'] = 2; $where['stype'] = 1; if ($member) { $array = array_column($member, 'id'); foreach($array as $k=>$v){ $where['mid'] = $v; $info[] = Dever::db('bill/sell')->getNewChildParent($where); } if(isset($info) && $info){ foreach($info as $k => $v){ $total += $v['total']; } } $total = sprintf ('%01.2f',$total); } return $total; } #新增正常业绩 public function new_zmoney($id){ $start = Dever::input('search_option_start_dever_time'); $end = Dever::input('search_option_end_dever_time'); $where = array(); if($start){ $where['start'] = $start; } if($end){ $where['end'] = $end; } $where['mid'] = $id; $where['state'] = 1; $where['type'] = 2; $where['stype'] = 1; $info = Dever::db('bill/sell')->getNewParent($where); $total = sprintf ('%01.2f',$info['total']); return $total; } #头衔统计数据导出 public function out_member($data){ $header = array('姓名', '手机号', '代理角色', '代理头衔', '直推业绩', '团队业绩', '新增业绩', '新增正常业绩'); $body = array(); foreach($data as $k => $v){ $role = Dever::db('setting/role')->find($v['role']); $title = Dever::db('setting/title')->find($v['title_id']); $new_sell = $this->new_money($v['id']); $new_zsell = $this->new_zmoney($v['id']); $d = array ( $v['name'], $v['mobile'], $role['name'], $title['name'], $v['sell'], $v['group_sell'], $new_sell, $new_zsell, ); $body[] = $d; } $file = Dever::input('excel_name'); return Dever::excelExport($body, $header, $file); } #归店记录明细导出(member_shop_log) public function out_member_shop_log ($data) { $header = array('姓名','手机号','代理角色','归店名称','归店时间'); $body = array(); if ($data) { foreach ($data as $k => $v) { $cdate = ''; if ($v['cdate']) { $cdate = date('Y-m-d H:i',$v['cdate']); } $member_name = ''; $member_mobile = ''; $role_name = ''; $member = Dever::db('agent/member')->find($v['mid']); if ($member) { $member_name = $member['name']; $member_mobile = $member['mobile']; $prize_type = ''; if ($member['role']) { $role = Dever::db('setting/role')->find($member['role']); if ($role['id'] == 8) { if ($member['prize_type'] == 1) { $prize_type = '(名额外)'; } elseif ($member['prize_type'] == 2) { $prize_type = '(名额内)'; } } $role_name = $role['name'].$prize_type; } } $shop_name = ''; if ($v['new_shop_id']) { $shop = Dever::db('shop/info')->find($v['new_shop_id']); if ($shop) { $shop_name = $shop['name']; } } $d = array ( $member_name, $member_mobile, $role_name, $shop_name, $cdate, ); $body[] = $d; } $file = Dever::input('excel_name'); return Dever::excelExport($body, $header, $file); } } }