|
@@ -70,7 +70,7 @@ class testControl extends mobileHomeControl
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * �������
|
|
|
|
|
|
+ * 首页
|
|
*/
|
|
*/
|
|
public function indexOp(){
|
|
public function indexOp(){
|
|
|
|
|
|
@@ -81,11 +81,31 @@ class testControl extends mobileHomeControl
|
|
// $payment = 500;
|
|
// $payment = 500;
|
|
// $payment = $payment = $this->getAndUpdateBonus(36218,$payment);
|
|
// $payment = $payment = $this->getAndUpdateBonus(36218,$payment);
|
|
// joutput_data(array('$payment'=>$payment));
|
|
// joutput_data(array('$payment'=>$payment));
|
|
|
|
+
|
|
|
|
+ // 修改地址
|
|
|
|
+ $order_id = "order_id in (297, 401, 923, 928,1097,1145,1150,1154,1244,1248,1281)";
|
|
|
|
+ $model = Model('order_common')->where($order_id)->select();
|
|
|
|
+ $model_address = Model('area');
|
|
|
|
+ $recv_info_array = array();
|
|
|
|
+ if ($model != null) {
|
|
|
|
+
|
|
|
|
+ foreach ($model as $val) {
|
|
|
|
+ $recv_info = unserialize($val['reciver_info']);
|
|
|
|
+
|
|
|
|
+ $recv_info['area'] = $model_address->formatAddress($recv_info['area']);
|
|
|
|
+ Model()->table('recv_info')->insert(array('order_id' => $val['order_id'], 'reciver_info' => serialize($recv_info)));
|
|
|
|
+
|
|
|
|
+ Model('order_common')->where(array('order_id'=>$val['order_id']))->update(array('reciver_info' => serialize($recv_info)));
|
|
|
|
+
|
|
|
|
+ array_push($recv_info_array, $recv_info);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ joutput_data($recv_info_array);
|
|
}
|
|
}
|
|
|
|
|
|
public function getAndUpdateBonus($user_id,$pay_amount){
|
|
public function getAndUpdateBonus($user_id,$pay_amount){
|
|
|
|
|
|
- // ��ȡ���к�� �������Ϊ 1 ��user_id = member_id,��ǰʱ��С�ڽ���ʱ��(��ʱδ��Ϊ����)
|
|
|
|
$condition['user_id'] = $user_id;
|
|
$condition['user_id'] = $user_id;
|
|
$condition['bonus_type_id'] = 1;
|
|
$condition['bonus_type_id'] = 1;
|
|
$bonus_list = Model()->table("user_bonus")->where($condition)->select();
|
|
$bonus_list = Model()->table("user_bonus")->where($condition)->select();
|
|
@@ -94,12 +114,11 @@ class testControl extends mobileHomeControl
|
|
if (!empty($bonus_list)) {
|
|
if (!empty($bonus_list)) {
|
|
|
|
|
|
foreach ($bonus_list as $value) {
|
|
foreach ($bonus_list as $value) {
|
|
- $bonus_value = doubleval($value['bonus_value']); // �����
|
|
|
|
|
|
+ $bonus_value = doubleval($value['bonus_value']);
|
|
|
|
|
|
- // ֧�������ں����-��Ҫ����ѡ����
|
|
|
|
if (($pay_amount - $bonus_value) > 0.0000001) {
|
|
if (($pay_amount - $bonus_value) > 0.0000001) {
|
|
|
|
|
|
- $data['bonus_value'] = 0; // ����Ϊ0
|
|
|
|
|
|
+ $data['bonus_value'] = 0;
|
|
$ret = Model()->table('user_bonus')->where(array('bonus_id' => $value['bonus_id']))->update($data);
|
|
$ret = Model()->table('user_bonus')->where(array('bonus_id' => $value['bonus_id']))->update($data);
|
|
|
|
|
|
if($ret){
|
|
if($ret){
|
|
@@ -120,4 +139,70 @@ class testControl extends mobileHomeControl
|
|
|
|
|
|
return $pay_amount;
|
|
return $pay_amount;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * order_sn
|
|
|
|
+ * member_id
|
|
|
|
+ *
|
|
|
|
+ * 手动退款接口
|
|
|
|
+ */
|
|
|
|
+ public function refundOp(){
|
|
|
|
+ $model_order = Model('order');
|
|
|
|
+ $model_trade = Model('trade');
|
|
|
|
+
|
|
|
|
+ $order_info = Model('order')->getOrderInfo(array('order_sn' => $_GET['order_sn']));
|
|
|
|
+ if (empty($order_info)) return;
|
|
|
|
+
|
|
|
|
+ $model_refund = Model('refund_return');
|
|
|
|
+ $order_id = intval($order_info['order_id']);
|
|
|
|
+ $condition = array();
|
|
|
|
+ $condition['buyer_id'] = $order_info['buyer_id'];
|
|
|
|
+ $condition['order_id'] = $order_id;
|
|
|
|
+ $order = $model_refund->getRightOrderList($condition);
|
|
|
|
+ $order_amount = $order['order_amount'];//订单金额
|
|
|
|
+ $condition = array();
|
|
|
|
+ $condition['buyer_id'] = $order['buyer_id'];
|
|
|
|
+ $condition['order_id'] = $order['order_id'];
|
|
|
|
+ $condition['goods_id'] = '0';
|
|
|
|
+ $condition['seller_state'] = array('lt','3');
|
|
|
|
+ $refund_list = $model_refund->getRefundReturnList($condition);
|
|
|
|
+ $refund = array();
|
|
|
|
+ if (!empty($refund_list) && is_array($refund_list)) {
|
|
|
|
+ $refund = $refund_list[0];
|
|
|
|
+ }
|
|
|
|
+ $order_paid = $model_trade->getOrderState('order_paid');//订单状态20:已付款
|
|
|
|
+ $payment_code = $order['payment_code'];//支付方式
|
|
|
|
+ if ($refund['refund_id'] > 0 || $order['order_state'] != $order_paid || $payment_code == 'offline') {//检查订单状态,防止页面刷新不及时造成数据错误
|
|
|
|
+ joutput_error(array("result" => false));
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $refund_array = array();
|
|
|
|
+ $refund_array['refund_type'] = '1';//类型:1为退款,2为退货
|
|
|
|
+ $refund_array['seller_state'] = '1';//状态:1为待审核,2为同意,3为不同意
|
|
|
|
+ $refund_array['order_lock'] = '2';//锁定类型:1为不用锁定,2为需要锁定
|
|
|
|
+ $refund_array['goods_id'] = '0';
|
|
|
|
+ $refund_array['order_goods_id'] = '0';
|
|
|
|
+ $refund_array['reason_id'] = '0';
|
|
|
|
+ $refund_array['reason_info'] = '取消订单,全部退款';
|
|
|
|
+ $refund_array['goods_name'] = '订单商品全部退款';
|
|
|
|
+ $refund_array['refund_amount'] = ncPriceFormat($order_amount);
|
|
|
|
+ $refund_array['buyer_message'] = $_POST['buyer_message'];
|
|
|
|
+ $refund_array['add_time'] = time();
|
|
|
|
+
|
|
|
|
+ $pic_array = array();
|
|
|
|
+ $pic_array['buyer'] = '';//$this->upload_pic();//上传凭证
|
|
|
|
+ $info = serialize($pic_array);
|
|
|
|
+ $refund_array['pic_info'] = $info;
|
|
|
|
+ $state = $model_refund->addRefundReturn($refund_array,$order);
|
|
|
|
+
|
|
|
|
+ if ($state) {
|
|
|
|
+ $model_refund->editOrderLock($order_id);
|
|
|
|
+ joutput_data(array("result" => true));
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ joutput_error(array("result" => false));
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|