|
@@ -169,7 +169,7 @@ class merchantControl extends SystemControl
|
|
|
Tpl::showpage('merchant.edit');
|
|
|
}
|
|
|
|
|
|
- private function credit_save_money($money , $operatetype , $member_id)
|
|
|
+ private function credit_save_money($money , $operatetype , $member_id , $bz = '')
|
|
|
{
|
|
|
$obj_member = Model('member');
|
|
|
$member_id = intval($member_id);
|
|
@@ -178,11 +178,11 @@ class merchantControl extends SystemControl
|
|
|
switch ($operatetype) {
|
|
|
case 1:
|
|
|
$admin_act = "sys_add_money";
|
|
|
- $log_msg = "管理员【" . $admininfo['admin_name'] . "】操作会员【" . $member_info['member_name'] . "】授信额度,预存款【增加】,金额为" . $money ;
|
|
|
+ $log_msg = "管理员【" . $admininfo['admin_name'] . "】操作会员【" . $member_info['member_name'] . "】,预存款【增加】,金额为" . $money ;
|
|
|
break;
|
|
|
case 2:
|
|
|
$admin_act = "sys_del_money";
|
|
|
- $log_msg = "管理员【" . $admininfo['admin_name'] . "】操作会员【" . $member_info['member_name'] . "】授信额度,预存款【减少】,金额为" . $money;
|
|
|
+ $log_msg = "管理员【" . $admininfo['admin_name'] . "】操作会员【" . $member_info['member_name'] . "】,预存款【减少】,金额为" . $money;
|
|
|
break;
|
|
|
default:
|
|
|
return [false , '调节类型错误'];
|
|
@@ -197,7 +197,7 @@ class merchantControl extends SystemControl
|
|
|
$data['order_sn'] = '';
|
|
|
$data['admin_name'] = $admininfo['name'];
|
|
|
$data['pdr_sn'] = '';
|
|
|
- $data['lg_desc'] = '管理员操作客户授信,更改会员余额。';
|
|
|
+ $data['lg_desc'] = $bz ? $bz : '管理员操作客户授信,更改会员余额。';
|
|
|
$model_pd->changePd($admin_act, $data);
|
|
|
|
|
|
$this->log($log_msg, 1);
|
|
@@ -581,6 +581,93 @@ class merchantControl extends SystemControl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public function recharge_manualOp()
|
|
|
+ {
|
|
|
+ if (chksubmit()) {
|
|
|
+ $obj_validate = new Validator();
|
|
|
+ $obj_validate->validateparam = [
|
|
|
+ ["input" => $_POST["mch_id"], "require" => "true", "message" => '机构号不能为空'],
|
|
|
+ ["input" => $_POST["bank_username"], "require" => "true", "message" => '开户人姓名不能为空'],
|
|
|
+ ["input" => $_POST["bank_name"], "require" => "true", "message" => '开户银行不能为空'],
|
|
|
+ ["input" => $_POST["pointsnum"], "require" => "true", "message" => '预存金额不能为空']
|
|
|
+ ];
|
|
|
+ $error = $obj_validate->validate();
|
|
|
+ if ($error != '') {
|
|
|
+ showMessage($error);
|
|
|
+ }
|
|
|
+ $mchid = $_POST["mch_id"];
|
|
|
+ $model_merchant = Model('merchant');
|
|
|
+ $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
|
|
|
+ if(!$merchant_info) {
|
|
|
+ showMessage('对应机构不存在');
|
|
|
+ }
|
|
|
+ $pointsnum = $_POST['pointsnum'];
|
|
|
+ $money = abs($pointsnum);
|
|
|
+ if($money == 0) {
|
|
|
+ showMessage('预存金额错误');
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ $model_merchant = Model('merchant');
|
|
|
+ $trans = new trans_wapper($model_merchant, __METHOD__);
|
|
|
+ $member_id = $merchant_info['admin_id'];
|
|
|
+ if($pointsnum > 0) {
|
|
|
+ $bz = '管理员操作手动预存金额增加';
|
|
|
+ $this->credit_save_money($money , 1 , $member_id , $bz);
|
|
|
+ }elseif ($pointsnum < 0) {
|
|
|
+ $bz = '管理员操作手动预存金额减少';
|
|
|
+ $this->credit_save_money($money , 2 , $member_id , $bz);
|
|
|
+ }else{
|
|
|
+ showMessage('预存金额错误');
|
|
|
+ }
|
|
|
+ $result = $this->ct_refill_evidence($_POST,$merchant_info);
|
|
|
+ if(!$result) {
|
|
|
+ $trans->rollback();
|
|
|
+ showMessage('操作失败', 'index.php?act=merchant&op=merchant');
|
|
|
+ }
|
|
|
+ $trans->commit();
|
|
|
+ if ($merchant_info['alarm_amount'] < $merchant_info['available_predeposit'])
|
|
|
+ {
|
|
|
+ //更新预警短信通知限制
|
|
|
+ $mch_cache = rcache("merchant-notify" , 'refill-');
|
|
|
+ $caches = empty($mch_cache['data']) ? [] : unserialize($mch_cache['data']);
|
|
|
+ $caches[$mchid] = ['last_time' => 0, 'send_count' => 0];
|
|
|
+ wcache("merchant-notify", ['data' => serialize($caches)], 'refill-');
|
|
|
+ }
|
|
|
+ showMessage('操作成功', 'index.php?act=merchant&op=refill_evidence');
|
|
|
+ } catch (Exception $e) {
|
|
|
+ $trans->rollback();
|
|
|
+ showMessage('操作失败', 'index.php?act=merchant&op=refill_evidence');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+
|
|
|
+ Tpl::showpage('recharge.manual.add');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private function ct_refill_evidence($params,$merchant_info)
|
|
|
+ {
|
|
|
+ $admininfo = $this->getAdminInfo();
|
|
|
+ $mem_info = Model('member')->getMemberInfo(['member_id' => $merchant_info['admin_id']]);
|
|
|
+ $input['mchid'] = $merchant_info['mchid'];
|
|
|
+ $input['mch_name'] = $merchant_info['name'];
|
|
|
+ $input['member_id'] = $merchant_info['admin_id'];
|
|
|
+ $input['amount'] = $params['pointsnum'];
|
|
|
+ $input['bank_username'] = $params['bank_username'];
|
|
|
+ $input['bank_name'] = $params['bank_name'];
|
|
|
+ $input['bz'] = $params['pointsdesc'];
|
|
|
+ $input['voucher_name'] = '/';
|
|
|
+ $input['status'] = 2;
|
|
|
+ $input['is_operation'] = 2;
|
|
|
+ $input['add_time'] = $input['check_time'] = time();
|
|
|
+ $input['after_available'] = ncPriceFormat($mem_info['available_predeposit'] + $params['pointsnum']);
|
|
|
+ $input['admin_name'] = $admininfo['name'];
|
|
|
+ $input['admin_id'] = $admininfo['id'];
|
|
|
+
|
|
|
+ $model_merchant = Model('merchant');
|
|
|
+ return $model_merchant->addRefillEvidence($input);
|
|
|
+ }
|
|
|
+
|
|
|
public function add_money()
|
|
|
{
|
|
|
$obj_validate = new Validator();
|
|
@@ -1223,7 +1310,7 @@ class merchantControl extends SystemControl
|
|
|
private function refill_stat($condition)
|
|
|
{
|
|
|
$model_refill_order = Model('refill_order');
|
|
|
- $i = $half_count = $hour_count = 0;
|
|
|
+ $i = $half_count = $hour_count = $exceed_three = $exceed_five = 0;
|
|
|
while (true)
|
|
|
{
|
|
|
$start = $i * 100000;
|
|
@@ -1240,6 +1327,12 @@ class merchantControl extends SystemControl
|
|
|
{
|
|
|
$order['diff_time'] = time() - $order['order_time'];
|
|
|
if($order['order_state'] == ORDER_STATE_SEND) {
|
|
|
+ if($order['diff_time'] > 180 && $order['diff_time'] < 500) {
|
|
|
+ $exceed_three++;
|
|
|
+ }
|
|
|
+ if($order['diff_time'] > 500) {
|
|
|
+ $exceed_five++;
|
|
|
+ }
|
|
|
if($order['diff_time'] > 1800 && $order['diff_time'] < 3600) {
|
|
|
$half_count++;
|
|
|
}
|
|
@@ -1254,6 +1347,87 @@ class merchantControl extends SystemControl
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- return ['half_count' => $half_count , 'hour_count' => $hour_count];
|
|
|
+ return ['half_count' => $half_count , 'hour_count' => $hour_count , 'exceed_three' => $exceed_three , 'exceed_five' => $exceed_five];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public function OrderSendListOp()
|
|
|
+ {
|
|
|
+ $model_refill_order = Model('refill_order');
|
|
|
+ $condition['refill_order.inner_status'] = 0;
|
|
|
+ $condition['refill_order.order_time'] = ['time', [strtotime(date("Y-m-d")), strtotime(date("Y-m-d"))]];
|
|
|
+ $condition['vr_order.order_state'] = ORDER_STATE_SEND;
|
|
|
+ if (!empty($_GET['order_sn'])) {
|
|
|
+ $condition['refill_order.order_sn'] = $_GET['order_sn'];
|
|
|
+ }
|
|
|
+ if (!empty($_GET['mch_order'])) {
|
|
|
+ $condition['refill_order.mch_order'] = $_GET['mch_order'];
|
|
|
+ }
|
|
|
+ if (!empty($_GET['mchid'])) {
|
|
|
+ $condition['refill_order.mchid'] = $_GET['mchid'];
|
|
|
+ }
|
|
|
+ if (!empty($_GET['channel_name'])) {
|
|
|
+ $condition['refill_order.channel_name'] = $_GET['channel_name'];
|
|
|
+ }
|
|
|
+ if (!empty($_GET['store_id'])) {
|
|
|
+ $condition['vr_order.store_id'] = $_GET['store_id'];
|
|
|
+ }
|
|
|
+ if (!empty($_GET['card_type'])) {
|
|
|
+ if(in_array($_GET['card_type'] , ['1' , '2' , '4' , '5' , '6'])) {
|
|
|
+ $condition['refill_order.card_type'] = $_GET['card_type'];
|
|
|
+ }
|
|
|
+ if($_GET['card_type'] == 'oil') {
|
|
|
+ $condition['refill_order.card_type'] = ['in' , ['1' , '2']];
|
|
|
+ }
|
|
|
+ if($_GET['card_type'] == 'phone') {
|
|
|
+ $condition['refill_order.card_type'] = ['in' , ['4' , '5' , '6']];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!empty($_GET['ch_trade_no'])) {
|
|
|
+ $condition['refill_order.ch_trade_no'] = $_GET['ch_trade_no'];
|
|
|
+ }
|
|
|
+ if (!empty($_GET['card_no'])) {
|
|
|
+ $condition['refill_order.card_no'] = $_GET['card_no'];
|
|
|
+ }
|
|
|
+ if (in_array($_GET['refill_amount'], ['10', '20', '30', '50' , '100', '200', '300', '500' , '1000', '20000'])) {
|
|
|
+ $condition['refill_order.refill_amount'] = $_GET['refill_amount'];
|
|
|
+ }
|
|
|
+ $start_unixtime = strtotime($_GET['query_start_time']);
|
|
|
+ $end_unixtime = strtotime($_GET['query_end_time']);
|
|
|
+
|
|
|
+ if ($start_unixtime >0 && $end_unixtime >0) {
|
|
|
+ $condition['refill_order.order_time'] = ['time', [$start_unixtime, $end_unixtime]];
|
|
|
+ }
|
|
|
+ if($_GET['time'] == 1){
|
|
|
+ $condition['refill_order.order_time'] = ['between', [(time() - 600) , (time() - 180)]];
|
|
|
+ }
|
|
|
+ if($_GET['time'] == 2){
|
|
|
+ $condition['refill_order.order_time'] = ['lt', (time() - 600)];
|
|
|
+ }
|
|
|
+ $merchant_list = Model('')->table('merchant')->limit(1000)->select();
|
|
|
+ foreach ($merchant_list as $key =>$value) {
|
|
|
+ $merchants[$value['mchid']] = $value;
|
|
|
+ }
|
|
|
+
|
|
|
+ $order_list = $model_refill_order->getMerchantOrderList($condition, 50, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
|
|
|
+
|
|
|
+ $stat = Model('')->table('refill_order,vr_order')->join('inner')
|
|
|
+ ->on('refill_order.order_id=vr_order.order_id')
|
|
|
+ ->field('count(*) as order_count ,sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts')
|
|
|
+ ->where($condition)->select();
|
|
|
+ $count = $this->refill_stat($condition);
|
|
|
+ foreach ($order_list as $order_id => $order_info) {
|
|
|
+ $order_list[$order_id]['card_type_text'] = $this->scard_type($order_info['card_type']);
|
|
|
+ $order_list[$order_id]['mch_name'] = $merchants[$order_info['mchid']]['company_name'];
|
|
|
+ $order_list[$order_id]['diff_time_text'] = $this->elapse_time(time() - $order_info['order_time']);
|
|
|
+ $order_list[$order_id]['diff_time'] = time() - $order_info['order_time'];
|
|
|
+ }
|
|
|
+ $provider_list = Model('')->table('refill_provider')->limit(100)->select();
|
|
|
+ Tpl::output('stat', $stat[0]);
|
|
|
+ Tpl::output('count', $count);
|
|
|
+ Tpl::output('order_list', $order_list);
|
|
|
+ Tpl::output('provider_list', $provider_list);
|
|
|
+ Tpl::output('show_page', $model_refill_order->showpage());
|
|
|
+ Tpl::showpage('refill.order.send.index');
|
|
|
}
|
|
|
}
|