コード例 #1
0
 /**
  * 店铺列表
  * 查询出所有店铺信息
  * 可以按标题进行搜索
  * @author						李东
  * @date						2015-06-12
  */
 public function index()
 {
     /*自动确认*/
     check_complete();
     if (I('title')) {
         $map['order_num'] = array('like', '%' . I('title') . '%');
     }
     $map['order_status'] = array('gt', '-1');
     $order = ' add_time desc,order_status asc,order_id desc';
     $result = $this->page(D($this->model), $map, $order, $field = array(), $this->limit);
     /* ($model,$map=array(),$order='',$field=array(),$limit='') */
     $result = int_to_string($result, array("order_status" => array("0" => "已取消", "1" => "未付款", "2" => "已付款", "3" => "已完成", "4" => "待退款", "5" => "已退款", '6' => '翻译完成', '7' => '已确认'), 'product_type' => array('1' => '笔译', '2' => '音频翻译', '3' => '口译')));
     /* 0已取消,1未付款,2已付款,3已完成,4待退款,5已退款 ,6翻译完成(等待客户确认),7用户已确认*/
     $data['result'] = $result;
     $this->assign($data);
     $this->display('index');
 }
コード例 #2
0
 public function appLogin()
 {
     //接收用户传值
     $type = intval(I('type'));
     //接收是那种形式的登录
     $username = addslashes(I('username'));
     //接收用户名
     $password = md5(md5(I('password')));
     //接收用户的密码
     //判断用户名或密码是否为空
     if (empty(I('username'))) {
         $this->error("用户名不能为空", "", true);
     }
     if (empty(I('password'))) {
         $this->error("密码不能为空", "", true);
     }
     //验证三种登录的公共信息是否正确
     $map['telephone'] = $username;
     $map['password'] = $password;
     $map['status'] = array("gt", -1);
     //$map['type']        = $type;//表示普通用户登录
     $info = get_info(D('ShopMemberView'), $map);
     //将用户的信息存入数组userinfo中
     $userinfo['home_member_id'] = $info['member_id'];
     //将用户的id存入userinfo中
     $userinfo['nickname'] = $info['username'];
     //用户的昵称存入userinfo中
     $userinfo['points'] = $info['points'];
     //用户的积分存入userinfo中
     $userinfo['login_time'] = md5($info["login_time"]);
     //登录时间存入userinfo中
     $userinfo['balance'] = $info['balance'];
     //账户余额
     $userinfo['withdrawals'] = $info['withdrawals'];
     //可提现金额
     $userinfo['shop_status'] = $info['shop_status'];
     //加入店铺的开通状态
     /*统计全部订单数*/
     $all_count = M("orders")->where(array('member_id' => $info['member_id']))->count();
     $userinfo['order_count'] = $all_count;
     //订单数
     //用户头像
     $userinfo['header_src'] = 'http://' . $_SERVER['SERVER_NAME'] . '/' . getAvatar($info['member_id']);
     if ($info['shop_id']) {
         //如果开店就将店铺的id存入到userinfo中去
         $userinfo['home_shop_id'] = $info['shop_id'];
     }
     if ($info and $info["status"] == 1) {
         //验证登录信息
         //不允许不同类型的用户之间相互乱登录
         if ($type == 1) {
             //表示普通的用户登录
             if ($info['role_id'] != 7) {
                 $this->error("您的身份不是普通用户!", "", true);
             }
         } else {
             if ($type == 2) {
                 if ($info['role_id'] != 8) {
                     $this->error("您的身份不是个人译者!", "", true);
                 }
             } else {
                 if ($type == 3) {
                     if ($info['role_id'] != 9) {
                         $this->error("您的身份不是翻译公司!", "", true);
                     }
                 }
             }
         }
         if (intval($info['member_id']) > 0) {
             /*如果是用户登录,更新用户有关的订单状态*/
             check_complete($info['member_id']);
         }
         if (intval($info['shop_id']) > 0) {
             /*如果是店铺登录,更新店铺所有的订单状态*/
             check_complete(0, $info['shop_id']);
         }
         $data["status"] = "1";
         $data["info"] = "登录成功!";
         $data["userinfo"] = $userinfo;
         $this->ajaxReturn($data);
     } else {
         if ($info and $info["status"] == 0) {
             $this->error('您的账户已被禁用,请联系客服!!', U('User/Login/index'), true);
         } else {
             $this->error("账户名或密码错误!!", "", true);
         }
     }
 }