|
@@ -29,7 +29,7 @@ class merchantControl extends SystemControl
|
|
|
$model_merchant = Model('merchant');
|
|
|
|
|
|
if (trim($_GET['merchant_name']) != '') {
|
|
|
- $condition['company_name'] = ['like', '%'.$_GET['merchant_name'].'%'];
|
|
|
+ $condition['company_name'] = ['like', '%' . $_GET['merchant_name'] . '%'];
|
|
|
}
|
|
|
|
|
|
$merchant_list = $model_merchant->getMerchantList($condition, 100, 'available_predeposit desc,merchant_state asc,mchid desc', true);
|
|
@@ -136,19 +136,17 @@ class merchantControl extends SystemControl
|
|
|
showMessage('机构信息有误');
|
|
|
}
|
|
|
|
|
|
- if (chksubmit())
|
|
|
- {
|
|
|
+ if (chksubmit()) {
|
|
|
$update_credit_bonus = ncPriceFormat($_POST['credit_bonus']);
|
|
|
- if($update_credit_bonus > 0)
|
|
|
- {
|
|
|
- if($merchant['credit_bonus'] + $update_credit_bonus < 0) {
|
|
|
+ if ($update_credit_bonus > 0) {
|
|
|
+ if ($merchant['credit_bonus'] + $update_credit_bonus < 0) {
|
|
|
showMessage('授信金额调整后不能小于0');
|
|
|
}
|
|
|
$operatetype = $_POST['operatetype'];
|
|
|
- if($operatetype == 'add') {
|
|
|
- $update['credit_bonus'] = ['exp','credit_bonus+'.$update_credit_bonus];
|
|
|
- }elseif($operatetype == 'del') {
|
|
|
- $update['credit_bonus'] = ['exp','credit_bonus-'.$update_credit_bonus];
|
|
|
+ if ($operatetype == 'add') {
|
|
|
+ $update['credit_bonus'] = ['exp', 'credit_bonus+' . $update_credit_bonus];
|
|
|
+ } elseif ($operatetype == 'del') {
|
|
|
+ $update['credit_bonus'] = ['exp', 'credit_bonus-' . $update_credit_bonus];
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -160,12 +158,11 @@ class merchantControl extends SystemControl
|
|
|
$update['quality'] = intval($_POST['quality']);
|
|
|
$update['oil_quality'] = intval($_POST['oil_quality']);
|
|
|
$member_id = $merchant['admin_id'];
|
|
|
- try
|
|
|
- {
|
|
|
+ try {
|
|
|
$model_merchant = Model('merchant');
|
|
|
$trans = new trans_wapper($model_merchant, __METHOD__);
|
|
|
|
|
|
- if($update_credit_bonus > 0) {
|
|
|
+ if ($update_credit_bonus > 0) {
|
|
|
$this->credit_save_money($update_credit_bonus, $operatetype, $member_id);
|
|
|
}
|
|
|
|
|
@@ -257,7 +254,7 @@ class merchantControl extends SystemControl
|
|
|
$model_merchant = Model('merchant');
|
|
|
$trans = new trans_wapper($model_merchant, __METHOD__);
|
|
|
//删除旧费率
|
|
|
- $model_merchant->delPrices(['mchid' => $mchid , 'quality' => $quality]);
|
|
|
+ $model_merchant->delPrices(['mchid' => $mchid, 'quality' => $quality]);
|
|
|
//更新新费率
|
|
|
if (!empty($inserts)) {
|
|
|
$model_merchant->insertPrices($inserts);
|
|
@@ -279,7 +276,7 @@ class merchantControl extends SystemControl
|
|
|
{
|
|
|
$mchid = $_GET['mchid'] ?? $_POST['mchid'];
|
|
|
$mod = Model('thrid_refill');
|
|
|
- if(chksubmit()) {
|
|
|
+ if (chksubmit()) {
|
|
|
//合并表单数据
|
|
|
$card_types = $_POST['cardtype'];
|
|
|
$specs = $_POST['spec'];
|
|
@@ -312,7 +309,7 @@ class merchantControl extends SystemControl
|
|
|
//删除旧费率
|
|
|
$model_merchant->delPrices(['mchid' => $mchid, 'quality' => $quality, 'pcode' => $param['pcode']]);
|
|
|
//更新新费率
|
|
|
- if(!empty($insert)) {
|
|
|
+ if (!empty($insert)) {
|
|
|
$model_merchant->table('merchant_price')->insert($insert);
|
|
|
}
|
|
|
}
|
|
@@ -322,15 +319,15 @@ class merchantControl extends SystemControl
|
|
|
$trans->rollback();
|
|
|
showMessage('操作失败', 'index.php?act=merchant&op=merchant', 'html', 'error');
|
|
|
}
|
|
|
- } else{
|
|
|
+ } else {
|
|
|
$condition = [];
|
|
|
- if(!empty($_GET['system_code'])) {
|
|
|
+ if (!empty($_GET['system_code'])) {
|
|
|
$condition['system_code'] = $_GET['system_code'];
|
|
|
}
|
|
|
if (trim($_GET['product_name']) != '') {
|
|
|
$condition['product_name'] = ['like', '%' . $_GET['product_name'] . '%'];
|
|
|
}
|
|
|
- $third_product = $mod->getProductList($condition,30);
|
|
|
+ $third_product = $mod->getProductList($condition, 30);
|
|
|
|
|
|
$model_merchant = Model('merchant');
|
|
|
$items = $model_merchant->table('merchant_price')->where(['mchid' => $mchid, 'quality' => 1, 'card_types' => mtopcard\ThirdRefillCard])->select();
|
|
@@ -367,9 +364,9 @@ class merchantControl extends SystemControl
|
|
|
} else {
|
|
|
continue;
|
|
|
}
|
|
|
- if(in_array($card_type, [mtopcard\ChinaMobileCard,mtopcard\ChinaUnicomCard,mtopcard\ChinaTelecomCard])) {
|
|
|
- if($quality == \refill\Quality::Quick) {
|
|
|
- $specs = array_merge($config['refill_phone_small_specs'],$specs);
|
|
|
+ if (in_array($card_type, [mtopcard\ChinaMobileCard, mtopcard\ChinaUnicomCard, mtopcard\ChinaTelecomCard])) {
|
|
|
+ if ($quality == \refill\Quality::Quick) {
|
|
|
+ $specs = array_merge($config['refill_phone_small_specs'], $specs);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -398,7 +395,7 @@ class merchantControl extends SystemControl
|
|
|
'spec' => intval($item['spec']),
|
|
|
'price' => $item['price'],
|
|
|
'extra_price' => $item['extra_price']
|
|
|
- ];
|
|
|
+ ];
|
|
|
}
|
|
|
}
|
|
|
return $result;
|
|
@@ -542,7 +539,7 @@ class merchantControl extends SystemControl
|
|
|
if (chksubmit()) {
|
|
|
$add_type = '';
|
|
|
$obj_validate = new Validator();
|
|
|
- if($type == 'add') {
|
|
|
+ if ($type == 'add') {
|
|
|
$add_type = '加款';
|
|
|
$obj_validate->validateparam = [
|
|
|
["input" => $_POST["mch_id"], "require" => "true", "message" => '机构号不能为空'],
|
|
@@ -575,14 +572,14 @@ class merchantControl extends SystemControl
|
|
|
if ($money == 0) {
|
|
|
showMessage('预存金额错误');
|
|
|
}
|
|
|
- if(!empty($_FILES['voucher']['name'])) {
|
|
|
+ if (!empty($_FILES['voucher']['name'])) {
|
|
|
$upload = new UploadFile();
|
|
|
- $upload->set('default_dir',ATTACH_UPFILE);
|
|
|
+ $upload->set('default_dir', ATTACH_UPFILE);
|
|
|
|
|
|
$result = $upload->upfile('voucher');
|
|
|
- if ($result){
|
|
|
+ if ($result) {
|
|
|
$_POST['voucher_name'] = $upload->file_name;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
showMessage($upload->error);
|
|
|
}
|
|
|
}
|
|
@@ -652,7 +649,7 @@ class merchantControl extends SystemControl
|
|
|
$input['admin_id'] = $admininfo['id'];
|
|
|
$input['add_type'] = $params['add_type'];
|
|
|
$input['receive_bank'] = $params['receive_bank'] ?? 0;
|
|
|
- if($params['type'] == 'add') {
|
|
|
+ if ($params['type'] == 'add') {
|
|
|
$input['is_bank'] = 1;
|
|
|
}
|
|
|
|
|
@@ -778,8 +775,8 @@ class merchantControl extends SystemControl
|
|
|
$order_id = $_GET['order_id'];
|
|
|
$mod_order = Model('vr_order');
|
|
|
$order_info = $mod_order->getOrderInfo(['order_id' => $order_id]);
|
|
|
- $refill_info = Model('refill_order')->getOrderInfo(['order_id' => $order_id,'inner_status' => 0,'is_retrying' => 0]);
|
|
|
- if(empty($refill_info)) {
|
|
|
+ $refill_info = Model('refill_order')->getOrderInfo(['order_id' => $order_id, 'inner_status' => 0, 'is_retrying' => 0]);
|
|
|
+ if (empty($refill_info)) {
|
|
|
showMessage('订单不存在,或不符合条件', '');
|
|
|
}
|
|
|
if ($order_info['order_state'] == ORDER_STATE_SEND) {
|
|
@@ -797,12 +794,12 @@ class merchantControl extends SystemControl
|
|
|
|
|
|
$mod_order = Model('vr_order');
|
|
|
$order_info = $mod_order->getOrderInfo(['order_id' => $order_id]);
|
|
|
- $refill_info = Model('refill_order')->getOrderInfo(['order_id' => $order_id,'inner_status' => 0,'is_retrying' => 0]);
|
|
|
- if(empty($refill_info)) {
|
|
|
+ $refill_info = Model('refill_order')->getOrderInfo(['order_id' => $order_id, 'inner_status' => 0, 'is_retrying' => 0]);
|
|
|
+ if (empty($refill_info)) {
|
|
|
showMessage('订单不存在,或不符合条件', '');
|
|
|
}
|
|
|
$check_fetch_order = $this->check_fetch_order($order_info['order_sn']);
|
|
|
- if($check_fetch_order == false) {
|
|
|
+ if ($check_fetch_order == false) {
|
|
|
showMessage('此订单不可手动操作,请联系抢单人员操作!');
|
|
|
}
|
|
|
if ($type == 'success') {
|
|
@@ -840,14 +837,14 @@ class merchantControl extends SystemControl
|
|
|
}
|
|
|
$operator = [mtopcard\ChinaMobileCard, mtopcard\ChinaUnicomCard, mtopcard\ChinaTelecomCard];
|
|
|
|
|
|
- if(chksubmit()) {
|
|
|
+ if (chksubmit()) {
|
|
|
foreach ($operator as $opr) {
|
|
|
$key = $opr . '-province';
|
|
|
$province = $_POST[$key];
|
|
|
- if($province == -1) {
|
|
|
+ if ($province == -1) {
|
|
|
$updata[$opr] = -1;
|
|
|
- }else{
|
|
|
- $updata[$opr] = implode(',',$province);
|
|
|
+ } else {
|
|
|
+ $updata[$opr] = implode(',', $province);
|
|
|
}
|
|
|
}
|
|
|
$resp = $provider_model->editProvider(['provinces' => serialize($updata)], ['provider_id' => $provider_id]);
|
|
@@ -861,7 +858,7 @@ class merchantControl extends SystemControl
|
|
|
$provinces = [];
|
|
|
|
|
|
foreach ($operator as $opr) {
|
|
|
- if(empty($data)) {
|
|
|
+ if (empty($data)) {
|
|
|
$provinces[$opr] = [-1];
|
|
|
} else {
|
|
|
$provinces[$opr] = explode(',', $data[$opr]);
|
|
@@ -978,7 +975,7 @@ class merchantControl extends SystemControl
|
|
|
$rkey = $this->speed_key($type, $form);
|
|
|
$quality = [
|
|
|
'common' => \refill\Quality::Normal, 'fast' => \refill\Quality::Quick, 'card' => \refill\Quality::CardKey,
|
|
|
- 'third' => \refill\Quality::ThirdShop, 'slow' => \refill\Quality::SlowTwentyFour , 'slow6' => \refill\Quality::SlowSix,
|
|
|
+ 'third' => \refill\Quality::ThirdShop, 'slow' => \refill\Quality::SlowTwentyFour, 'slow6' => \refill\Quality::SlowSix,
|
|
|
'slow2' => \refill\Quality::SlowTwo, 'slow48' => \refill\Quality::SlowFortyEight, 'slow72' => \refill\Quality::SlowSeventyTwo
|
|
|
];
|
|
|
if (chksubmit()) {
|
|
@@ -1048,7 +1045,7 @@ class merchantControl extends SystemControl
|
|
|
$amounts = $formData['amounts'];
|
|
|
$cfgs = $formData['cfgs'];
|
|
|
$types = $formData['types'];
|
|
|
- if(!empty($speed_limit)) {
|
|
|
+ if (!empty($speed_limit)) {
|
|
|
foreach ($speed_limit as $key => $speed) {
|
|
|
foreach ($speed as $value) {
|
|
|
$speed_limit[$key][$value['pid']] = $value;
|
|
@@ -1127,9 +1124,9 @@ class merchantControl extends SystemControl
|
|
|
if ($type == 2) {
|
|
|
$amounts = $config['refill_phone_specs'];
|
|
|
$cfgs = $config['phone_providers'];
|
|
|
- if($form == 'fast') {
|
|
|
+ if ($form == 'fast') {
|
|
|
//快充质量,加小面值
|
|
|
- $amounts = array_merge($config['refill_phone_small_specs'],$amounts);
|
|
|
+ $amounts = array_merge($config['refill_phone_small_specs'], $amounts);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1163,24 +1160,24 @@ class merchantControl extends SystemControl
|
|
|
$refund = $_POST['refund'] ?? 0;
|
|
|
$remark = $_POST['remark'];
|
|
|
$gap_order_count = $gap_success_amounts = $gap_success_refill_amounts = 0;
|
|
|
- if($type == 'provider') {
|
|
|
- if(!empty($corder_success_amounts)) {
|
|
|
+ if ($type == 'provider') {
|
|
|
+ if (!empty($corder_success_amounts)) {
|
|
|
$gap_success_amounts = $corder_success_amounts - $stats_data['success_channel_amounts'];
|
|
|
}
|
|
|
- if(!empty($corder_success_count)) {
|
|
|
+ if (!empty($corder_success_count)) {
|
|
|
$gap_order_count = $corder_success_count - $stats_data['success_count'];
|
|
|
}
|
|
|
- }elseif ($type == 'merchant') {
|
|
|
- if(!empty($corder_success_count)) {
|
|
|
+ } elseif ($type == 'merchant') {
|
|
|
+ if (!empty($corder_success_count)) {
|
|
|
$gap_order_count = $stats_data['success_count'] - $corder_success_count;
|
|
|
}
|
|
|
- if(!empty($corder_success_amounts)) {
|
|
|
+ if (!empty($corder_success_amounts)) {
|
|
|
$gap_success_amounts = $stats_data['success_channel_amounts'] - $corder_success_amounts;
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
showMessage('对账数据类型错误', 'index.php?act=OrderStats&op=index');
|
|
|
}
|
|
|
- if(!empty($corder_success_refill_amounts)) {
|
|
|
+ if (!empty($corder_success_refill_amounts)) {
|
|
|
$gap_success_refill_amounts = $corder_success_refill_amounts - $stats_data['success_refill_amounts'];
|
|
|
}
|
|
|
|
|
@@ -1192,17 +1189,17 @@ class merchantControl extends SystemControl
|
|
|
$updata['gap_success_refill_amounts'] = $gap_success_refill_amounts;
|
|
|
$updata['remark'] = $remark;
|
|
|
$updata['refund'] = $refund;
|
|
|
- if(!empty($corder_success_count) && !empty($corder_success_amounts) && !empty($corder_success_refill_amounts)) {
|
|
|
- if($gap_order_count == 0 && $gap_success_amounts == 0 && $gap_success_refill_amounts == 0 ) {
|
|
|
+ if (!empty($corder_success_count) && !empty($corder_success_amounts) && !empty($corder_success_refill_amounts)) {
|
|
|
+ if ($gap_order_count == 0 && $gap_success_amounts == 0 && $gap_success_refill_amounts == 0) {
|
|
|
$updata['check_status'] = 1;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$updata['check_status'] = 2;
|
|
|
}
|
|
|
}
|
|
|
$res = $mod_stat->edit($stat_id, $updata);
|
|
|
|
|
|
if ($res) {
|
|
|
- showMessage('操作成功',"index.php?act=OrderStats&op=index&type={$type}&cid={$stats_data['cid']}&order_time_type={$stats_data['order_time_type']}");
|
|
|
+ showMessage('操作成功', "index.php?act=OrderStats&op=index&type={$type}&cid={$stats_data['cid']}&order_time_type={$stats_data['order_time_type']}");
|
|
|
} else {
|
|
|
showMessage('操作失败');
|
|
|
}
|
|
@@ -1226,10 +1223,10 @@ class merchantControl extends SystemControl
|
|
|
try {
|
|
|
$trans = new trans_wapper($mod_stat, __METHOD__);
|
|
|
//更新新数据
|
|
|
- if($stats_data['type'] == 'merchant') {
|
|
|
- $refill->merchant_stat($stats_data['time_stamp'],$stats_data['cid'],$stats_data['order_time_type']);
|
|
|
- }elseif ($stats_data['type'] == 'provider') {
|
|
|
- $refill->provider_stat($stats_data['time_stamp'],$stats_data['cid'],$stats_data['order_time_type']);
|
|
|
+ if ($stats_data['type'] == 'merchant') {
|
|
|
+ $refill->merchant_stat($stats_data['time_stamp'], $stats_data['cid'], $stats_data['order_time_type']);
|
|
|
+ } elseif ($stats_data['type'] == 'provider') {
|
|
|
+ $refill->provider_stat($stats_data['time_stamp'], $stats_data['cid'], $stats_data['order_time_type']);
|
|
|
}
|
|
|
$trans->commit();
|
|
|
showMessage('操作成功');
|
|
@@ -1238,4 +1235,57 @@ class merchantControl extends SystemControl
|
|
|
showMessage('操作失败');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public function merchant_interceptOp()
|
|
|
+ {
|
|
|
+ $mchid = $_GET['mchid'] ?? $_POST['mchid'];
|
|
|
+ $model_merchant = Model('merchant');
|
|
|
+ $merchant = $model_merchant->getMerchantInfo(['mchid' => $mchid], '*', true);
|
|
|
+ if (empty($merchant)) {
|
|
|
+ showMessage('机构信息有误');
|
|
|
+ }
|
|
|
+ if (chksubmit()) {
|
|
|
+ $merchant_intercept['is_transfer'] = $_POST['is_transfer'];
|
|
|
+ if (!empty($_POST['card_states'])) {
|
|
|
+ $merchant_intercept['card_states'] = $_POST['card_states'];
|
|
|
+ }
|
|
|
+ $merchant_intercept = serialize($merchant_intercept);
|
|
|
+ $resp = $model_merchant->editMerchant(['merchant_intercept' => $merchant_intercept], ['mchid' => $mchid]);
|
|
|
+ if ($resp) {
|
|
|
+ showMessage('操作成功', 'index.php?act=merchant&op=merchant');
|
|
|
+ } else {
|
|
|
+ showMessage('操作失败');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $merchant_intercept = $merchant['merchant_intercept'];
|
|
|
+ if (empty($merchant_intercept)) {
|
|
|
+ $merchant_intercept = ['card_states' => [], 'is_transfer' => 0];
|
|
|
+ } else {
|
|
|
+ $merchant_intercept = unserialize($merchant_intercept);
|
|
|
+ }
|
|
|
+ Tpl::output('merchant', $merchant);
|
|
|
+ Tpl::output('card_state', mtopcard\CardState);
|
|
|
+ Tpl::output('merchant_intercept', $merchant_intercept);
|
|
|
+ Tpl::showpage('merchant.intercept');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function merchant_retry_timesOp()
|
|
|
+ {
|
|
|
+ $mchid = $_GET['mchid'] ?? $_POST['mchid'];
|
|
|
+ $model_merchant = Model('merchant');
|
|
|
+ $merchant = $model_merchant->getMerchantInfo(['mchid' => $mchid], '*', true);
|
|
|
+ if (empty($merchant)) {
|
|
|
+ showMessage('机构信息有误');
|
|
|
+ }
|
|
|
+ if (chksubmit()) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ $quality = [
|
|
|
+ 'common' => \refill\Quality::Normal, 'fast' => \refill\Quality::Quick, 'card' => \refill\Quality::CardKey,
|
|
|
+ 'third' => \refill\Quality::ThirdShop, 'slow' => \refill\Quality::SlowTwentyFour, 'slow6' => \refill\Quality::SlowSix,
|
|
|
+ 'slow2' => \refill\Quality::SlowTwo, 'slow48' => \refill\Quality::SlowFortyEight, 'slow72' => \refill\Quality::SlowSeventyTwo
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|