Commit 08a1ea85 by 朱继来

fix

parents a652d430 c4128182
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Model\OrderModel;
use App\Model\OrderActionLogModel;
use DB;
class SpecialController extends Controller
{
// 订单特殊处理,用于测试调整运费
public function changeOrderPrice(Request $request)
{
$mobile = $request->input('mobile', '');
$order_id = $request->input('order_id', '');
if (!$mobile || !$order_id) {
echo '参数缺失';die;
}
// 检查是否为测试账号
$test_mobile = Config('params.test_mobile');
if (!in_array($mobile, $test_mobile)) {
echo '非测试账号';die;
}
DB::connection('order')->beginTransaction();
$order = DB::connection('order')->table('lie_order_price')->where('order_id', $order_id)->where('price_type', 3)->first();
if (!$order) {
echo '运费不存在';die;
}
$data['price'] = 0;
$update = DB::connection('order')->table('lie_order_price')->where('order_id', $order_id)->where('price_type', 3)->update($data);
if (!$update) {
DB::connection('order')->rollback();
echo '运费更新失败';die;
}
$OrderModel = new OrderModel();
$order_info = $OrderModel->find($order_id);
$intracode = DB::table('lie_intracode')->where('user_id', $order_info['user_id'])->select('admin_id')->first();
$sale_id = $intracode ? $intracode->admin_id : 0;
// 操作记录
$OrderActionLogModel = new OrderActionLogModel();
$actionLog = $OrderActionLogModel->addLog($order_id, $sale_id, 2, '调整运费为0');
if (!$actionLog) {
DB::connection('order')->rollback();
echo '添加运费更新日志失败';die;
}
DB::connection('order')->commit();
echo '运费更新成功';
}
}
\ No newline at end of file
......@@ -126,5 +126,6 @@ Route::group(['middleware' => 'api'], function () {
Route::get ('/api/check/sendsms', 'OrderController@checkOrderSendSms');
Route::get ('/api/check/cancelorder', 'OrderController@checkOrderCancel');
Route::get ('/api/check/histroyorder', 'OrderController@checkHistroyOrder');
Route::get ('/api/check/changeprice', 'SpecialController@changeOrderPrice');
});
......@@ -352,7 +352,7 @@ class OrderModel extends Model
if ($order[$i]['order_goods_type'] == 2) {
$tmp[$i]['sale_type'] = $order[$i]['sale_type'] == 1 ? '现卖' : '预售';
$tmp[$i]['business_type'] = Config('params.business_type')[$order[$i]['business_type']]; // 自营其他业务类型
$tmp[$i]['business_type'] = $order[$i]['business_type'] ? Config('params.business_type')[$order[$i]['business_type']] : '正常订单'; // 自营其他业务类型
}
$tmp[$i]['user_account'] = $order[$i]['mobile'] ? $order[$i]['mobile'] : $order[$i]['email'];
......
......@@ -61,8 +61,12 @@
// 特殊业务类型
'business_type' => [
0 => '正常订单',
1 => '样品销售',
2 => '仓库损耗',
],
// 测试账号
'test_mobile' => [
'15989573440',
],
];
\ No newline at end of file
......@@ -38,9 +38,9 @@
// 自营其他订单类型---仓库损耗
if (mobile == '15022222222') {
$('#business_type').val(2);
$('#business_type').val(2).attr('disabled', true);
} else {
$('#business_type').val(1);
$('#business_type').val(1).attr('disabled', false);
}
$.ajax({
......
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 sign in to comment