Ejemplo n.º 1
0
 /**
  * 分配用户到客户经理下
  */
 public function director_user()
 {
     $id = $this->_get('id');
     //经理ID
     $DirectorUser = D('DirectorUser');
     //经理用户关系表
     $Users = D('Users');
     //查找是否为客户经理
     $director_info = $Users->field('id,account,name')->where(array('status' => 0, 'id' => $id, 'type' => C('ACCOUNT_TYPE.Director')))->find();
     if (empty($id) || !is_numeric($id) || empty($director_info)) {
         $this->error('客户经理不存在!');
     }
     //查找指定的用户数据
     $map['u.type'] = 1;
     //筛选条件
     $map['u.status'] = 0;
     $list = $Users->seek_user_data($map);
     if ($list) {
         $relation = $DirectorUser->get_director_user($id);
         $user_ids = getArrayByField($relation, 'user_id');
         foreach ($list as $key => $val) {
             if (in_array($val['id'], $user_ids)) {
                 $list[$key]['checked'] = 'checked="checked"';
             }
         }
     }
     $this->assign('director_id', $id);
     $this->assign('header', $director_info['account']);
     $this->assign('list', $list);
     $this->display();
 }
Ejemplo n.º 2
0
 /**
  * 分配已购买用户
  */
 public function relevance_product_user()
 {
     $id = $this->_get('id');
     //产品ID
     $Product = D('Product');
     //理财产品
     $Users = D('Users');
     $ProductUser = D('ProductUser');
     /* 理财产品信息 */
     $product_info = $Product->seek_one_data($id);
     if (empty($product_info)) {
         $this->error('此产品不存在!');
     }
     //查找指定的用户数据
     $map['u.type'] = 1;
     //筛选条件
     $map['u.status'] = 0;
     $list = $Users->seek_user_data($map);
     if ($list) {
         $relevance = $ProductUser->seek_user_product($id);
         $relevance_tmp = getArrayByField($relevance, 'users_id');
         foreach ($list as $key => $val) {
             if (in_array($val['id'], $relevance_tmp)) {
                 $list[$key]['checked'] = 'checked="checked"';
             }
         }
     }
     $this->assign('product_id', $id);
     $this->assign('header', $product_info['name']);
     $this->assign('list', $list);
     $this->display();
 }