Commit 6c10dd39 authored by zhz's avatar zhz

evalute

parent 2e783da6
......@@ -52,7 +52,7 @@ class OrderConst {
const storeWaiteSend='请尽快发货';
const waitBuyerConfirmRecieve='等待用户确认收货';
const defaultComment = '好评!';
}
......
......@@ -44,7 +44,7 @@ class EvaluationServiceModel extends \Business\AbstractModel {
* @throws \Our\Exception
*/
public function submit($data,$memberId){
list($order,$orderGoods) = $this->_submitValite($data,$memberId);
list($data, $order, $orderGoods) = $this->_submitValite($data,$memberId);
foreach ($orderGoods as $v){
$orderGoods[$v['goods_id']] = $v;
......@@ -63,7 +63,7 @@ class EvaluationServiceModel extends \Business\AbstractModel {
$evaluation['geval_goodsprice'] = $orderGoods[$v['goodsId']]['goods_pay_price'];
$evaluation['geval_goodsimage'] = $orderGoods[$v['goodsId']]['goods_image'];
$evaluation['geval_scores'] = intval($v['scores']);
$evaluation['geval_content'] = trim($v['geval_content']);
$evaluation['geval_content'] = $v['geval_content'] ? trim($v['geval_content']) : \Our\OrderConst::defaultComment;
$evaluation['geval_isanonymous'] = intval($data['isanonymous']);
$evaluation['geval_addtime'] = time();
$evaluation['geval_storeid'] = $order['store_id'];
......@@ -73,6 +73,7 @@ class EvaluationServiceModel extends \Business\AbstractModel {
$evaluation['memberAvatar'] = $memberAvatar;
//$images = $this->_upload($v['images']);
$images = $v['images'];
if(!is_array($images)) $images = json_decode($images, true);
$images ? $data['goods'][$k]['haveImg'] = 1 : $data['goods'][$k]['haveImg'] = 0;
$evaluation['geval_image'] = serialize($images);
$goodsInstance = \DAO\GoodsModel::getInstance();
......@@ -81,8 +82,10 @@ class EvaluationServiceModel extends \Business\AbstractModel {
$data['goods'][$k]['goodsCommonId'] = $evaluation['geval_goods_commonid'];
$evaluations[] = $evaluation;
}
$log = \Our\Log::getInstance();
$log->write(json_encode($evaluations));
$result = \DAO\EvaluateGoodsModel::getInstance()->insertAll($evaluations);
$log->write(json_encode($result));
if(!$result){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::commonError);
}
......@@ -206,7 +209,6 @@ class EvaluationServiceModel extends \Business\AbstractModel {
$param['deliveryCredit'] || \Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyDeliveryCredit);
$param['deliveryCredit'] || \Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyServiceCredit);
$log = \Our\Log::getInstance();
// $log->write(print_r($data, true));
$log->write(json_encode($param['goods']));
if(!is_array($param['goods'])) {
$param['goods'] = json_decode($param['goods'],true);
......@@ -232,7 +234,7 @@ class EvaluationServiceModel extends \Business\AbstractModel {
if($goodsIds1 != $goodsIds2){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::orderError);
}
return array($order,$orderGoods);
return array($param, $order, $orderGoods);
}
public function autoEvaluate() {
$list = \DAO\Order\OrderModel::getInstance()->getList(array('finnshed_time'=>array('elt',time()-(\Our\ApiConst::sevenDaySecond)),'evaluation_state'=>\Our\ApiConst::waitEvaluation),'order_id',0,1000,'');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment