Authored by xiaowei

log 合并 解决冲突

... ... @@ -20,6 +20,7 @@ use Hood\Session;
use WebPlugin\Mobile;
use Api\Yohobuy;
use LibModels\Web\Passport\LoginData;
use WebPlugin\UdpLog;
class WebAction extends Controller_Abstract
{
... ... @@ -383,6 +384,7 @@ class WebAction extends Controller_Abstract
$token = Helpers::makeToken($uid);
$uidCookie = $userInfo['data']['profile_name'] . '::' . $userInfo['data']['uid'] . '::' . $userInfo['data']['vip_info']['title'] . '::' . $token;
$this->setCookie('_UID',$uidCookie,time() + 86400 * 360);
UdpLog::info('【登录】同步登陆cookie生成',$uidCookie);
}
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $uid);
... ... @@ -402,7 +404,7 @@ class WebAction extends Controller_Abstract
if (!$this->_useSession) {
$useSession = false;
}
$useSession = false;
//$useSession = false;
if (!$this->_uid) {
$cookie = $this->getCookie('_UID');
... ...
... ... @@ -95,7 +95,7 @@ class InfoData
*/
public static function getArticleInfo($id, $onlyUrl = false)
{
$param['article_id'] = $id;
$param['article_id'] = intval($id);
return self::webApi(self::getUrl('getArticle'), $param, $onlyUrl);
}
... ... @@ -107,7 +107,7 @@ class InfoData
*/
public static function author($authorId, $onlyUrl = false)
{
$param['author_id'] = $authorId;
$param['author_id'] = intval($authorId);
return self::webApi(self::getUrl('author'), $param, $onlyUrl);
}
... ... @@ -121,8 +121,8 @@ class InfoData
public static function tagTop($page = 1,$limit = 10, $onlyUrl = false)
{
$param['page'] = $page;
$param['limit'] = $limit;
$param['page'] = intval($page);
$param['limit'] = intval($limit);
return self::webApi(self::getUrl('getTagTop'), $param, $onlyUrl);
}
... ... @@ -136,9 +136,9 @@ class InfoData
*/
public static function comment($articleId, $page = 1, $limit = 10, $onlyUrl = false)
{
$param['article_id'] = $articleId;
$param['page'] = $page;
$param['limit'] = $limit;
$param['article_id'] = intval($articleId);
$param['page'] = intval($page);
$param['limit'] = intval($limit);
return self::webApi(self::getUrl('commentList'), $param, $onlyUrl);
}
... ... @@ -150,7 +150,7 @@ class InfoData
*/
public static function articleContent($articleId, $onlyUrl = false)
{
$param['article_id'] = $articleId;
$param['article_id'] = intval($articleId);
return self::webApi(self::getUrl('getArticleContent'), $param, $onlyUrl);
}
... ... @@ -164,7 +164,7 @@ class InfoData
*/
public static function baseInfo($articleId, $uid, $udid, $onlyUrl = false)
{
$param['id'] = $articleId;
$param['id'] = intval($articleId);
$param['uid'] = $uid;
$param['udid'] = $udid;
return self::webApi(self::getUrl('getArticleBaseInfo'), $param, $onlyUrl);
... ... @@ -178,7 +178,7 @@ class InfoData
*/
public static function relateBrand($articleId, $onlyUrl = false)
{
$param['article_id'] = $articleId;
$param['article_id'] = intval($articleId);
return self::webApi(self::getUrl('getBrand'), $param, $onlyUrl);
}
... ... @@ -192,9 +192,9 @@ class InfoData
*/
public static function relateList($articleId, $tag, $limit = 3, $onlyUrl = false)
{
$param['article_id'] = $articleId;
$param['article_id'] = intval($articleId);
$param['tags'] = $tag;
$param['limit'] = $limit;
$param['limit'] = intval($limit);
return self::webApi(self::getUrl('getOtherArticle'), $param, $onlyUrl);
}
... ... @@ -210,8 +210,8 @@ class InfoData
public static function recommend($gender, $page = 1, $limit = 10, $onlyUrl = false)
{
$param['gender'] = $gender;
$param['page'] = $page;
$param['limit'] = $limit;
$param['page'] = intval($page);
$param['limit'] = intval($limit);
return self::webApi(self::getUrl('getArticleByViewsNum'), $param, $onlyUrl);
}
... ... @@ -224,7 +224,7 @@ class InfoData
*/
public static function addComment($id, $uid, $content)
{
$param['article_id'] = $id;
$param['article_id'] = intval($id);
$param['uid'] = $uid;
$param['content'] = $content;
return self::webApi(self::getUrl('addComment'), $param);
... ... @@ -238,7 +238,7 @@ class InfoData
*/
public static function setPraise($id, $udid)
{
$param['article_id'] = $id;
$param['article_id'] = intval($id);
$param['udid'] = $udid;
return self::webApi(self::getUrl('setPraise'), $param);
}
... ... @@ -251,7 +251,7 @@ class InfoData
*/
public static function cancelPraise($id, $udid)
{
$param['article_id'] = $id;
$param['article_id'] = intval($id);
$param['udid'] = $udid;
return self::webApi(self::getUrl('cancelPraise'), $param);
}
... ... @@ -264,7 +264,7 @@ class InfoData
*/
public static function setFavorite($id, $uid)
{
$param['article_id'] = $id;
$param['article_id'] = intval($id);
$param['uid'] = $uid;
return self::webApi(self::getUrl('setFavorite'), $param);
}
... ... @@ -277,7 +277,7 @@ class InfoData
*/
public static function cancelFavorite($id, $uid)
{
$param['article_id'] = $id;
$param['article_id'] = intval($id);
$param['uid'] = $uid;
return self::webApi(self::getUrl('cancelFavorite'), $param);
}
... ...
... ... @@ -513,5 +513,5 @@ class CartData
$param['payment'] = $payment;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
}
... ...
... ... @@ -15,13 +15,13 @@ use Api\Sign;
class SaleData
{
/**
* @param $specialsaleId 专区ID
* @param int $specialsaleId 专区ID
* @return array
*/
public static function getSpecial($specialsaleId)
{
$param = Yohobuy::param();
$param['special_id'] = $specialsaleId;
$param['special_id'] = intval($specialsaleId);
$param['method'] = 'app.resources.getOneSpecial';
$param['client_secret'] = Sign::getSign($param);
... ...
<?php
namespace WebPlugin;
use WebPlugin\UdpLog;
/**
* 异常错误日志
*/
class TriggerError
{
public static function myErrorHandler($errno, $errstr, $errfile, $errline)
{
// print_r(get_defined_constants());exit;
switch ($errno) {
case \YAF\ERR\NOTFOUND\CONTROLLER:
case \YAF\ERR\NOTFOUND\MODULE:
case \YAF\ERR\NOTFOUND\ACTION:
header("Not Found");
break;
default:
$data['errno'] = $errno;
$data['errstr'] = $errstr;
$data['errfile'] = $errfile;
$data['errline'] = $errline;
UdpLog::triggerError('triggerError',$data);
break;
}
return true;
}
}
... ...
... ... @@ -149,6 +149,15 @@ class Bootstrap extends Bootstrap_Abstract
//}
}
/**
* triggerError
* @param Dispatcher $dispatcher
*/
public function _initError(Dispatcher $dispatcher)
{
$dispatcher->getInstance()->setErrorHandler(array("\\WebPlugin\\TriggerError","myErrorHandler"));
}
// /**
// * 初始化第三方包
// * @param Dispatcher $dispatcher
... ...
... ... @@ -10,6 +10,7 @@ use WebPlugin\Cache;
use WebPlugin\Images;
use Configs\WebCacheConfig;
use Hood\Core\Security\AuthCode;
use WebPlugin\UdpLog;
/**
* 购物车相关的模板数据模型
... ... @@ -56,6 +57,7 @@ class CartModel
$result['isEmpty'] = true;
$result['guangUrl'] = Helpers::url('', null, 'list');
$result['viewOrderUrl'] = Helpers::url('/home/orders', array('t' => time()));
UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'shoppingKey:'.$shoppingKey);
break;
}
... ... @@ -223,6 +225,8 @@ class CartModel
$addCart = CartData::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey);
if ($addCart && isset($addCart['code'])) {
$result = $addCart;
}else{
UdpLog::info('【购物车】校验参数传递auth','productSku:'.$productSku.'buyNumber:'.$buyNumber.'goodsType:'.$goodsType,'isEdit:'.$isEdit.'promotionId:'.$promotionId.'uid:'.$uid.'shoppingKey:'.$shoppingKey);
}
return $result;
... ... @@ -243,6 +247,7 @@ class CartModel
do {
if (empty($skuList)) {
UdpLog::info('【购物车】校验参数传递auth','skuList:'.$skuList);
break;
}
... ... @@ -250,6 +255,8 @@ class CartModel
if ($select && isset($select['code'])) {
$result['code'] = $select['code'];
$result['message'] = $select['message'];
}else{
UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'skuList:'.$skuList.'shoppingKey:'.$shoppingKey.'hasPromotion:'.$hasPromotion);
}
} while (false);
... ... @@ -272,6 +279,7 @@ class CartModel
do {
if (empty($skuList)) {
UdpLog::info('【购物车】校验参数传递auth','skuList:'.$skuList);
break;
}
... ... @@ -282,6 +290,8 @@ class CartModel
if (isset($remove['data']['goods_count'])) {
$result['total_goods_num'] = $remove['data']['goods_count'];
}
}else{
UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'skuList:'.$skuList.'shoppingKey:'.$shoppingKey.'hasPromotion:'.$hasPromotion);
}
} while (false);
... ... @@ -305,11 +315,11 @@ class CartModel
$result['code'] = 403;
$result['message'] = '请先登录!';
$result['data']['url'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/shopping/cart')));
break;
}
if (empty($skuList)) {
UdpLog::info('【购物车】校验参数传递auth','skuList:'.$skuList);
break;
}
... ... @@ -317,6 +327,8 @@ class CartModel
if ($add && isset($add['code'])) {
$result['code'] = $add['code'];
$result['message'] = $add['message'];
}else{
UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'skuList:'.$skuList.'hasPromotion:'.$hasPromotion);
}
} while (false);
... ... @@ -339,6 +351,7 @@ class CartModel
do {
if (empty($sku)) {
UdpLog::info('【购物车】校验参数传递auth','sku:'.$sku);
break;
}
... ... @@ -346,6 +359,8 @@ class CartModel
if ($modify && isset($modify['code'])) {
$result['code'] = $modify['code'];
$result['message'] = $modify['message'];
}else{
UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'sku:'.$sku,'increaseNum:'.$increaseNum.'decreaseNum:'.$decreaseNum.'shoppingKey:'.$shoppingKey);
}
} while (false);
... ... @@ -419,6 +434,7 @@ class CartModel
$browse = CartData::browseRecord($uid, $udid, $page, 6);
if (empty($browse['data']['product_list'])) {
UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'udid'.$udid.'page'.$page);
break;
}
... ... @@ -836,16 +852,19 @@ class CartModel
do {
if (empty($addressId)) {
UdpLog::info('【结算信息】配送地址参数校验','addressId为空');
$result['code'] = 401;
$result['message'] = '配送地址不能为空';
break;
}
if (empty($deliveryTimeId)) {
UdpLog::info('【结算信息】配送时间参数校验','deliveryTime为空');
$result['code'] = 402;
$result['message'] = '请选择配送时间';
break;
}
if (empty($deliveryWayId)) {
UdpLog::info('【结算信息】配送方式参数校验','deliveryWay为空');
$result['code'] = 403;
$result['message'] = '请选择配送方式';
break;
... ...
... ... @@ -3,6 +3,7 @@
use Action\WebAction;
use WebPlugin\Helpers;
use Shopping\CartModel;
use WebPlugin\UdpLog;
/**
* 购物车相关的控制器
... ... @@ -451,9 +452,9 @@ class IndexController extends WebAction
// 调用下单接口
$result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceTitle, $invoiceId,
$paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes);
// 判断是否下单成功
if (empty($result['data']['order_code'])) {
UdpLog::info('【结算信息】判断是否下单成功','order_code'.$result['data']['order_code']);
break;
}
... ... @@ -464,13 +465,13 @@ class IndexController extends WebAction
// $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
//
// // 记录下单异常的数据
// if (empty($result)) {
// $message = 'uid:' . $uid . ',addressId:' . $addressId . ',cartType:' . $cartType . ',deliveryTime:' . $deliveryTime
// . ',deliveryWay:' . $deliveryWay . 'invoiceTitle:' . $invoiceTitle . ',invoiceId:' . $invoiceId . ',yohoCoin:' . $yohoCoin
// . ',paymentId:' . $paymentId . ',paymentType:' . $paymentType . ',remark:' . $remark . ',couponCode:' . $couponCode . "\n";
// error_log($message, 3, '/Data/logs/php/pc_error/order.' . date('Ym') . '.log');
// }
// 记录下单异常的数据
if (empty($result)) {
$message = 'uid:' . $uid . ',addressId:' . $addressId . ',cartType:' . $cartType . ',deliveryTime:' . $deliveryTime
. ',deliveryWay:' . $deliveryWay . 'invoiceTitle:' . $invoiceTitle . ',invoiceId:' . $invoiceId . ',yohoCoin:' . $yohoCoin
. ',paymentId:' . $paymentId . ',paymentType:' . $paymentType . ',remark:' . $remark . ',couponCode:' . $couponCode . "\n";
UdpLog::info('【下单】下单异常数据','message:'.$message,'返回:'.json_encode($result));
}
// // 返回数据
// else {
// // 提交成功清除Cookie
... ...
... ... @@ -7,6 +7,7 @@ use Passport\PassportModel;
use Configs\ChannelConfig;
use WebPlugin\Helpers;
use WebPlugin\Cache;
use WebPlugin\UdpLog;
/**
* 登录
... ... @@ -113,6 +114,7 @@ class LoginController extends WebAction
$verifyCode = trim($this->post('captcha'));
$isRemember = $this->post('isRemember');
if (!is_numeric($area) || empty($account) || empty($password)) {
UdpLog::info('【登录】校验参数传递auth','area:'.$area.'account:'.$account.'password:'.$password);
break;
}
... ... @@ -124,6 +126,7 @@ class LoginController extends WebAction
$verifyMobile = is_numeric($account);
}
if (!$verifyEmail && !$verifyMobile) {
UdpLog::info('【登录】校验账号是否有效auth','email:'.$verifyEmail.'mobile:'.$verifyMobile);
break;
}
... ... @@ -165,6 +168,7 @@ class LoginController extends WebAction
if ($verifyCode) {
$picFlag = PassportModel::verifyCode($verifyCode);
if (!$picFlag) {
UdpLog::info('【登录】登录验证码','area:'.$area.'account:'.$account.'verifyCode:'.$verifyCode);
$data = array('code' => 400, 'message' => '验证码不正确或验证码已过期', 'data' => array('needCaptcha' => true, 'errorType' => 'captcha'));
break;
}
... ...
... ... @@ -6,6 +6,7 @@ use WebPlugin\Helpers;
use WebPlugin\Cache;
use Passport\PassportModel;
use LibModels\Web\Passport\BindData;
use WebPlugin\UdpLog;
/**
* 注册
... ... @@ -265,6 +266,7 @@ class RegisterController extends WebAction
$mobile = trim($this->post('mobile'));
$area = trim($this->post('area'));
if (!is_numeric($mobile) || !is_numeric($area)) {
UdpLog::info('【注册】参数校验', 'mobile:'.$mobile.'area:'.$area);
$data['message'] = '手机号码格式不正确';
break;
}
... ... @@ -272,6 +274,7 @@ class RegisterController extends WebAction
/* 判断是否是有效的注册方式,防注册机刷 */
$effectiveTime = $this->getSession('effective_time');
if ($effectiveTime < time() || empty($effectiveTime)) {
UdpLog::info('【注册】超时', 'mobile:'.$mobile.'area:'.$area);
$data['message'] = '注册超时';
break;
}
... ... @@ -279,6 +282,7 @@ class RegisterController extends WebAction
//检测验证码不正确
$verifyCode = strtolower(trim($this->post('verifyCode'))); //图形验证码
if (!PassportModel::verifyCode($verifyCode)) {
UdpLog::info('【注册】验证码不正确', 'mobile:'.$mobile.'area:'.$area.'verifyCode:'.$verifyCode);
$data['message'] = '验证码不正确';
break;
}
... ... @@ -287,6 +291,7 @@ class RegisterController extends WebAction
$code = trim($this->post('code')); //手机验证码
$password = $this->post('password');
if (!Helpers::verifyPassword($password)) {
UdpLog::info('【注册】密码格式问题', 'mobile:'.$mobile.'area:'.$area.'password:'.$password);
$data['message'] = '密码不正确';
break;
}
... ... @@ -302,6 +307,7 @@ class RegisterController extends WebAction
$ipTimes = intval($ipTimes);
}
if ($ipTimes >= 500) {
UdpLog::info('【注册】ip限制', 'mobile:'.$mobile.'area:'.$area.'ip:'.$ip.'ipTimes:'.$ipTimes);
$data['message'] = '由于你IP受限无法注册';
break;
}
... ... @@ -309,6 +315,7 @@ class RegisterController extends WebAction
/* 验证注册的标识码是否有效 */
$data = RegData::validMobileCode($area, $mobile, $code);
if (!isset($data['code']) || $data['code'] != 200) {
UdpLog::info('【注册】短信验证码校验', 'mobile:'.$mobile.'area:'.$area.'code:'.$code);
$data['message'] = '验证码错误';
break;
}
... ...