|
@@ -16,6 +16,77 @@ class ShiHuiController extends O2oBaseController {
|
|
|
return $this->shiHuiCheckSign();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //取消订单
|
|
|
+ public function actionDel(){
|
|
|
+ $data['key'] = Yii::app()->params['shKey'];
|
|
|
+ $data['version'] = '1.0';
|
|
|
+ $data['serviceType'] = (int)26;
|
|
|
+ $data['orderId'] = '57fde8059f5160c4048b4aeb';
|
|
|
+
|
|
|
+ ksort($data);
|
|
|
+ $str = '';
|
|
|
+ $dat = '';
|
|
|
+ foreach ($data as $key => $value) {
|
|
|
+ $str .= $key.'='.$value.'&';
|
|
|
+ $dat .= $key.'='.urlencode($value).'&';
|
|
|
+ }
|
|
|
+ $str = rtrim(trim($str),'&');
|
|
|
+
|
|
|
+
|
|
|
+ $str .= $str.Yii::app()->params['shMd5Key'];
|
|
|
+
|
|
|
+ $data['sign'] = strtoupper(md5($str));
|
|
|
+ $dat .= 'sign='.urlencode($data['sign']);//构建post 参数
|
|
|
+ $url = 'http://test2.app.hiwemeet.com/v2/openpf/home/order/thirdOrder/cancel'; //调用接口的平台服务地址
|
|
|
+
|
|
|
+ $ch = curl_init();
|
|
|
+ curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false);
|
|
|
+ curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
+ curl_setopt($ch, CURLOPT_POST, 1);
|
|
|
+ curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
|
|
|
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $dat);
|
|
|
+ $result = curl_exec($ch);
|
|
|
+ curl_close($ch);
|
|
|
+ echo $result;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新订单状态
|
|
|
+ public function actionUpdateStatus(){
|
|
|
+ $data['key'] = Yii::app()->params['shKey'];
|
|
|
+ $data['version'] = '1.0';
|
|
|
+ $data['serviceType'] = (int)26;
|
|
|
+ $data['orderId'] = '57fde8059f5160c4048b4aeb';
|
|
|
+ $data['status'] = '-1';
|
|
|
+ ksort($data);
|
|
|
+ $str = '';
|
|
|
+ $dat = '';
|
|
|
+ foreach ($data as $key => $value) {
|
|
|
+ $str .= $key.'='.$value.'&';
|
|
|
+ $dat .= $key.'='.urlencode($value).'&';
|
|
|
+ }
|
|
|
+ $str = rtrim(trim($str),'&');
|
|
|
+
|
|
|
+ $str .= $str.Yii::app()->params['shMd5Key'];
|
|
|
+
|
|
|
+ $data['sign'] = strtoupper(md5($str));
|
|
|
+ $dat .= 'sign='.urlencode($data['sign']);//构建post 参数
|
|
|
+ $url = 'http://test2.app.hiwemeet.com/v2/openpf/home/order/thirdOrder/update'; //调用接口的平台服务地址
|
|
|
+
|
|
|
+ $ch = curl_init();
|
|
|
+ curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false);
|
|
|
+ curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
+ curl_setopt($ch, CURLOPT_POST, 1);
|
|
|
+ curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
|
|
|
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $dat);
|
|
|
+ $result = curl_exec($ch);
|
|
|
+ curl_close($ch);
|
|
|
+ echo $result;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// 获取服务时间接口
|
|
|
public function actionQueryTime(){
|
|
|
$latitude = Yii::app()->getRequest()->getParam("latitude"); //服务地址经纬度(火星坐标系)
|
|
@@ -121,40 +192,54 @@ class ShiHuiController extends O2oBaseController {
|
|
|
public function actionCreateOrder(){
|
|
|
$cityId = Yii::app()->getRequest()->getParam("cityId");
|
|
|
$productId = Yii::app()->getRequest()->getParam("productId");
|
|
|
- $packageId = Yii::app()->getRequest()->getParam("packageId");
|
|
|
- $product_obj = Product::get(new MongoId($productId));
|
|
|
- $product_list = array();
|
|
|
- $service_type = 0;
|
|
|
+ $product_const = Yii::app()->params['ProductId'];
|
|
|
+
|
|
|
+ foreach ($product_const as $key => $value) {
|
|
|
+ $flag =1;
|
|
|
+ foreach ($value as $k => $v) {
|
|
|
+
|
|
|
+ if ($productId == $k){
|
|
|
+ $extra_type = $v;
|
|
|
+ if ($key == 2){
|
|
|
+ $productId = '57e0e0189f5160dc048b4568';//深度清洁id
|
|
|
+ $service_type = 2; $flag =0;break;
|
|
|
+
|
|
|
+ } else if($key == 1){
|
|
|
+ $productId = '57e0dffc9f5160dd048b4568';//日常清洁id
|
|
|
+ $service_type = 1; $flag =0;break;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!$flag) break;
|
|
|
+
|
|
|
+ }
|
|
|
+ $criteria = new EMongoCriteria();
|
|
|
+ $criteria->_id('==',new MongoId($productId));
|
|
|
+ //$criteria->addCond('extra.type','==',$extra_type);
|
|
|
+ $product_obj = Product::model()->find($criteria);
|
|
|
+
|
|
|
+ $products = array();
|
|
|
$price = 0;
|
|
|
if($product_obj){
|
|
|
- $product_temp['product'] = $product_obj->_id;
|
|
|
- $product_temp['count'] = 1;
|
|
|
- $price = $product_obj->price;
|
|
|
- $product_list[] = $product_temp;
|
|
|
- $service_type = $product_obj->type;
|
|
|
+ $products[0]['product'] = $product_obj->_id;
|
|
|
+ $products[0]['count'] = 1;
|
|
|
+ $products[0]['extra'] = $product_obj->extra[$extra_type];
|
|
|
}else{
|
|
|
- CommonFn::requestAjax(false,CommonFn::getMessage('o2o','product_not_exist'));
|
|
|
- }
|
|
|
- if($packageId && $packageId != 1){
|
|
|
- $package_obj = Product::get(new MongoId($packageId));
|
|
|
- $product_temp['product'] = $package_obj->_id;
|
|
|
- $price += $package_obj->price;
|
|
|
- $product_temp['count'] = 1;
|
|
|
- $product_list[] = $product_temp;
|
|
|
+ echo '{"code": "1003","msg": "product_not_exist!"}';
|
|
|
+ die();
|
|
|
}
|
|
|
- $serviceTime = Yii::app()->getRequest()->getParam("serviceTime"); //服务开始时间,格式为2015-04-18 10:30:00
|
|
|
+ $serviceTime = Yii::app()->getRequest()->getParam("serviceStartTime"); //服务开始时间,格式为2015-04-18 10:30:00
|
|
|
$final_price = Yii::app()->getRequest()->getParam("price"); //产品价格,以元为单位,精确到分
|
|
|
$latitude = Yii::app()->getRequest()->getParam("latitude"); //服务地址经纬度(火星坐标系)
|
|
|
+ $counts = Yii::app()->getRequest()->getParam("amount");
|
|
|
$longitude = Yii::app()->getRequest()->getParam("longitude"); //服务地址经纬度(火星坐标系)
|
|
|
$serviceAddress = Yii::app()->getRequest()->getParam("serviceAddress"); //服务地址,精确到小区
|
|
|
- $houseNumber = Yii::app()->getRequest()->getParam("houseNumber"); //服务地址,门牌号等详细信息
|
|
|
- $cellphone = Yii::app()->getRequest()->getParam("cellphone"); //用户电话
|
|
|
- $serviceId = Yii::app()->getRequest()->getParam("serviceId"); //点评服务项目ID
|
|
|
- $packageId = Yii::app()->getRequest()->getParam("packageId"); //服务方套餐ID
|
|
|
- $quantity = Yii::app()->getRequest()->getParam("quantity"); //预约份数,默认为1
|
|
|
- $technicianId = Yii::app()->getRequest()->getParam("technicianId"); //预约份数,默认为1
|
|
|
- $comment = Yii::app()->getRequest()->getParam("comment"); //用户备注
|
|
|
- $extraInfo = Yii::app()->getRequest()->getParam("extraInfo"); //订单个性化信息,JSON字符串(具体内容在对接的时候进行沟通)
|
|
|
+ $houseNumber = Yii::app()->getRequest()->getParam("detailAddress"); //服务地址,门牌号等详细信息
|
|
|
+ $cellphone = Yii::app()->getRequest()->getParam("phone"); //用户电话
|
|
|
+
|
|
|
+ $comment = Yii::app()->getRequest()->getParam("remark"); //用户备注
|
|
|
+ $name = Yii::app()->getRequest()->getParam("contactName");//用户姓名
|
|
|
|
|
|
$position = CommonFn::GCJTobaidu($latitude,$longitude);
|
|
|
$location = $position['lat'].','.$position['lng'];
|
|
@@ -181,10 +266,10 @@ class ShiHuiController extends O2oBaseController {
|
|
|
die();
|
|
|
}
|
|
|
$order = new ROrder();
|
|
|
- $order->channel = 'dianping';
|
|
|
+ $order->channel = 'shihui';
|
|
|
$order->order_time = time();
|
|
|
$order->booking_time = strtotime($serviceTime);
|
|
|
- $order->products = $product_list;
|
|
|
+ $order->products = $products;
|
|
|
// $order->precedence = $precedence; //加急状态
|
|
|
$order->price = intval($price);
|
|
|
$order->final_price = intval($final_price);
|
|
@@ -192,43 +277,48 @@ class ShiHuiController extends O2oBaseController {
|
|
|
$address['province'] = $cityinfo['province'];
|
|
|
$address['city'] = $cityinfo['city'];
|
|
|
$address['area'] = $cityinfo['area'];
|
|
|
+ $address['name'] = $name;
|
|
|
+
|
|
|
if($serviceAddress == $houseNumber){
|
|
|
$address['detail'] = $serviceAddress;
|
|
|
}else{
|
|
|
$address['detail'] = $serviceAddress.$houseNumber;
|
|
|
}
|
|
|
+ $address['poi']['name'] = $address[detail];
|
|
|
$address['mobile'] = $cellphone;
|
|
|
- $position[0] = isset($position['lng'])?floatval($position['lng']):0;
|
|
|
- $position[1] = isset($position['lat'])?floatval($position['lat']):0;
|
|
|
- $address['position'] = $position;
|
|
|
- $address['name'] = '大众点评用户';
|
|
|
+ $positions[0] = isset($position['lng'])?floatval($position['lng']):0;
|
|
|
+ $positions[1] = isset($position['lat'])?floatval($position['lat']):0;
|
|
|
+ $address['position'] = $positions;
|
|
|
+ $address['position'] = $positions;
|
|
|
$order->address = $address;
|
|
|
$order->memo = $comment;
|
|
|
$order->station = new MongoId('5548b05e0eb9fbc5728b51ea');
|
|
|
// $order->coupons = $used_coupon;
|
|
|
$order->status = 0;
|
|
|
$order->user = '';
|
|
|
+ $order->pay_channel = 'shihui';
|
|
|
$order->type = $service_type;
|
|
|
+ $order->price = $products[0]['extra']['price'];
|
|
|
+ $order->counts = $counts;
|
|
|
if($order->save()){
|
|
|
echo '{
|
|
|
- "code": "0",
|
|
|
- "msg": "success",
|
|
|
- "body": {
|
|
|
+ "code": "1",
|
|
|
+ "msg": "创建订单成功",
|
|
|
+ "result": {
|
|
|
"orderId": "'.(string)$order->_id.'"
|
|
|
}
|
|
|
}';
|
|
|
}else{
|
|
|
echo '{
|
|
|
- "code": "1",
|
|
|
- "msg": "false",
|
|
|
- "body": {}
|
|
|
+ "code": "1004",
|
|
|
+ "msg": "创建订单失败",
|
|
|
}';
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
//取消订单
|
|
|
- public function actionDel(){
|
|
|
+ public function actionQueryDel(){
|
|
|
$order_id = Yii::app()->getRequest()->getParam("orderId");
|
|
|
if( !$order_id || !CommonFn::isMongoId($order_id)){
|
|
|
CommonFn::requestAjax(false,CommonFn::getMessage('message','params_illegal'));
|