Example #1
0
 public function updateVendorInfo($vendorInfo, $vendorType)
 {
     $result = false;
     //获取数据库连接
     $conn = DaoBase::_getConn();
     mysql_query("BEGIN");
     //或者mysql_query("START TRANSACTION");
     //获取Session中的vendor
     $vendor = User::_getVendor();
     if ($vendorInfo != null && $vendor != null) {
         $infoId = $vendor['vendor_info_id'];
         $resType = false;
         //判断商家类型是否需要修改
         $dao = new DaoVendor();
         if ($dao->updateTransaction($conn, array("vendor_type" => $vendorType), array("vendor_id = " => $vendor['vendor_id']))) {
             //更新session信息
             $vendor['vendor_type'] = $vendorType;
             $resType = true;
         }
         //更新商家信息
         $data = array("info_tele" => $vendorInfo['mobile'], "info_fax" => $vendorInfo['faxs'], "info_email" => $vendorInfo['email'], "info_address" => $vendorInfo['address'], "info_qq" => $vendorInfo['qq'], "info_wechat" => $vendorInfo['webChat'], "info_taobao" => $vendorInfo['taobao'], "info_leader" => $vendorInfo['leader'], "vendor_lable" => $vendorInfo['vendorLabel']);
         $where = array("info_id = " => $infoId);
         $dao = new DaoVendorInfo();
         $resInfo = $dao->update($data, $where);
     }
     $result = $resType && $resInfo;
     if ($result) {
         mysql_query("COMMIT");
         //更新session信息
         User::_setVendor($vendor);
     } else {
         mysql_query("ROLLBACK");
     }
     DaoBase::_closeConn($conn);
     return $result;
 }
Example #2
0
 public function userLoginNotCode()
 {
     $res = array();
     $name = isset($_REQUEST['UserName']) ? $_REQUEST['UserName'] : null;
     $pwd = isset($_REQUEST['Password']) ? $_REQUEST['Password'] : null;
     if ($name == null) {
         $res['result'] = 0;
         $res['info'] = "用户名不能为空";
         echo json_encode($res);
         return;
     }
     if ($pwd == null) {
         $res['result'] = 0;
         $res['info'] = "密码不能为空";
         echo json_encode($res);
         return;
     }
     //判断用户名,密码是否正确
     $model = new LoginModel();
     if ($vendor = $model->UserLogin($name, $pwd)) {
         //设置Session
         User::_setVendor($vendor);
         $res['result'] = 1;
         $res['vendorId'] = $vendor['vendor_id'];
         $res['lastLoginTime'] = $vendor['vendor_lastLoginTime'];
         $res['vendor_type'] = $vendor['vendor_type'];
     } else {
         $res['result'] = 0;
         $res['info'] = "用户不存在";
     }
     echo json_encode($res);
 }