|
@@ -5,8 +5,8 @@
|
|
|
**by 好商城V3 www.33hao.com 运营版*/
|
|
|
|
|
|
defined('InShopNC') or exit('Access Invalid!');
|
|
|
+
|
|
|
require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
|
|
|
-use refill;
|
|
|
|
|
|
|
|
|
class merchantControl extends SystemControl
|
|
@@ -151,8 +151,8 @@ class merchantControl extends SystemControl
|
|
|
|
|
|
public function priceOp()
|
|
|
{
|
|
|
- $lang = Language::getLangContent();
|
|
|
- if (chksubmit()) {
|
|
|
+ if (chksubmit())
|
|
|
+ {
|
|
|
$mchid = $_POST['mchid'];
|
|
|
|
|
|
//合并表单数据
|
|
@@ -163,13 +163,14 @@ class merchantControl extends SystemControl
|
|
|
foreach ($card_types as $key => $card_type) {
|
|
|
$data['card_type'] = $card_type;
|
|
|
$data['spec'] = intval($specs[$key]);
|
|
|
- $data['price'] = number_format($prices[$key], 2, '.', '');
|
|
|
+ $data['price'] = ncPriceFormat($prices[$key]);
|
|
|
$data['amount_limit'] = $amount_limit[$key];
|
|
|
$params[] = $data;
|
|
|
}
|
|
|
- foreach ($params as $param) {
|
|
|
- if($param['price'] > 0)
|
|
|
- {
|
|
|
+
|
|
|
+ foreach ($params as $param)
|
|
|
+ {
|
|
|
+ if($param['price'] > 0) {
|
|
|
$insert['mchid'] = $mchid;
|
|
|
$insert['spec'] = $param['spec'];
|
|
|
$insert['price'] = $param['price'];
|
|
@@ -178,12 +179,13 @@ class merchantControl extends SystemControl
|
|
|
$inserts[] = $insert;
|
|
|
}
|
|
|
}
|
|
|
- if(empty($inserts))
|
|
|
- {
|
|
|
+
|
|
|
+ if(empty($inserts)) {
|
|
|
showMessage('操作成功', 'index.php?act=merchant&op=merchant');
|
|
|
}
|
|
|
- $model_merchant = Model('merchant');
|
|
|
+
|
|
|
try {
|
|
|
+ $model_merchant = Model('merchant');
|
|
|
$trans = new trans_wapper($model_merchant, __METHOD__);
|
|
|
//删除旧费率
|
|
|
$model_merchant->delPrices($mchid);
|
|
@@ -196,6 +198,7 @@ class merchantControl extends SystemControl
|
|
|
showMessage('操作失败', 'index.php?act=merchant&op=merchant', 'html', 'error');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
$mchid = $_GET['mchid'] ?? 0;
|
|
|
$goods = $this->GoodsFormat($mchid);
|
|
|
Tpl::output('goods', $goods);
|
|
@@ -218,20 +221,25 @@ class merchantControl extends SystemControl
|
|
|
private function GoodsFormat($mchid)
|
|
|
{
|
|
|
global $config;
|
|
|
- $goods = $this->GoodsKeyFormat($config['provider_goods']);
|
|
|
+ $cardtype_amounts = $this->cardtype_amounts($config['provider_goods']);
|
|
|
+
|
|
|
$model_merchant = Model('merchant');
|
|
|
$items = $model_merchant->table('merchant_price')->where(['mchid' => $mchid])->select();
|
|
|
- foreach ($goods as $key => $value) {
|
|
|
- foreach ($value as $amount) {
|
|
|
- $goods_name = $this->scard_type($key);
|
|
|
+ foreach ($cardtype_amounts as $card_type => $amounts)
|
|
|
+ {
|
|
|
+ foreach ($amounts as $amount)
|
|
|
+ {
|
|
|
+ $goods_name = $this->scard_type($card_type);
|
|
|
$data['goods_name'] = $goods_name;
|
|
|
- $data['card_type'] = $key;
|
|
|
+ $data['card_type'] = $card_type;
|
|
|
$data['spec'] = $amount;
|
|
|
$data['amount_limit'] = -1;
|
|
|
$data['price'] = 0;
|
|
|
- foreach ($items as $item) {
|
|
|
+
|
|
|
+ foreach ($items as $item)
|
|
|
+ {
|
|
|
$item['types'] = explode(',' , $item['card_types']);
|
|
|
- if ($amount == $item['spec'] && in_array($key , $item['types'])) {
|
|
|
+ if ($amount == $item['spec'] && in_array($card_type , $item['types'])) {
|
|
|
$data['price'] = $item['price'];
|
|
|
$data['amount_limit'] = $item['amount_limit'];
|
|
|
}
|
|
@@ -242,10 +250,11 @@ class merchantControl extends SystemControl
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
- private function GoodsKeyFormat($goods)
|
|
|
+ private function cardtype_amounts($goods)
|
|
|
{
|
|
|
$data = [];
|
|
|
- foreach ($goods as $key => $value) {
|
|
|
+ foreach ($goods as $key => $value)
|
|
|
+ {
|
|
|
if ($key == 'petrochina') { //中石油
|
|
|
$key = 1;
|
|
|
} elseif ($key == 'sinopec') { //中石化
|
|
@@ -256,29 +265,13 @@ class merchantControl extends SystemControl
|
|
|
$key = 5;
|
|
|
} elseif ($key == 'chinatelecom') { //中国电信
|
|
|
$key = 6;
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
}
|
|
|
+
|
|
|
$data[$key] = $value;
|
|
|
}
|
|
|
- return $data;
|
|
|
- }
|
|
|
|
|
|
- private function PricesFormat($items)
|
|
|
- {
|
|
|
- $data = [];
|
|
|
- foreach ($items as $key => $item) {
|
|
|
- if (strlen($item['card_types']) > 1) {
|
|
|
- $card_types = explode(',', $item['card_types']);
|
|
|
- foreach ($card_types as $card_type) {
|
|
|
- $item['card_type'] = $card_type;
|
|
|
- unset($item['card_types']);
|
|
|
- $data[] = $item;
|
|
|
- }
|
|
|
- } else {
|
|
|
- $item['card_type'] = $item['card_types'];
|
|
|
- unset($item['card_types']);
|
|
|
- $data[] = $item;
|
|
|
- }
|
|
|
- }
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
@@ -313,12 +306,11 @@ class merchantControl extends SystemControl
|
|
|
$list = $model_merchant->getMerchantInfo($condition);
|
|
|
if (empty($list)) {
|
|
|
echo 'true';
|
|
|
- exit;
|
|
|
} else {
|
|
|
echo 'false';
|
|
|
- exit;
|
|
|
}
|
|
|
- break;
|
|
|
+ exit;
|
|
|
+
|
|
|
/**
|
|
|
* 验证机构是否存在
|
|
|
*/
|
|
@@ -327,12 +319,10 @@ class merchantControl extends SystemControl
|
|
|
$list = $model_merchant->getMerchantInfo($condition);
|
|
|
if (!empty($list)) {
|
|
|
echo 'true';
|
|
|
- exit;
|
|
|
} else {
|
|
|
echo 'false';
|
|
|
- exit;
|
|
|
}
|
|
|
- break;
|
|
|
+ exit;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -341,8 +331,6 @@ class merchantControl extends SystemControl
|
|
|
*/
|
|
|
public function refill_evidenceOp()
|
|
|
{
|
|
|
- $lang = Language::getLangContent();
|
|
|
-
|
|
|
$model_merchant = Model('merchant');
|
|
|
$condition = [];
|
|
|
if (trim($_GET['mch_name']) != '') {
|
|
@@ -459,6 +447,7 @@ class merchantControl extends SystemControl
|
|
|
$order_sn = $apply_id;
|
|
|
$admininfo = $this->getAdminInfo();
|
|
|
$log_msg = "管理员【" . $admininfo['admin_name'] . "】操作会员【" . $member_info['member_name'] . "】预存款,金额为" . $money . ",编号为" . $order_sn;
|
|
|
+
|
|
|
$admin_act = 'sys_add_money';
|
|
|
switch ($_POST['operatetype']) {
|
|
|
case 1:
|
|
@@ -767,18 +756,6 @@ class merchantControl extends SystemControl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private function whereStr_ct($cond){
|
|
|
- if(empty($cond)){
|
|
|
- return '';
|
|
|
- }
|
|
|
- $where = '';
|
|
|
- foreach ($cond as $key => $value){
|
|
|
- $where .= "( {$key} = '{$value}' ) AND ";
|
|
|
- }
|
|
|
- $where = ' WHERE ' . $where;
|
|
|
- return rtrim($where ,' AND ');
|
|
|
- }
|
|
|
-
|
|
|
private function scard_type(int $card_type)
|
|
|
{
|
|
|
if ($card_type == 1) { //中石油
|
|
@@ -796,27 +773,6 @@ class merchantControl extends SystemControl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private function topcard_type($str_type)
|
|
|
- {
|
|
|
- if (empty($str_type)) {
|
|
|
- return '未知';
|
|
|
- }
|
|
|
- $str_type = trim(strtolower($str_type));
|
|
|
- if ($str_type == 'petrochina') { //中石油
|
|
|
- return '中石油';
|
|
|
- } elseif ($str_type == 'sinopec') { //中石化
|
|
|
- return '中石化';
|
|
|
- } elseif ($str_type == 'chinamobile') { //中国移动
|
|
|
- return '中国移动';
|
|
|
- } elseif ($str_type == 'chinaunicom') { //中国联通
|
|
|
- return '中国联通';
|
|
|
- } elseif ($str_type == 'chinatelecom') { //中国电信
|
|
|
- return '中国电信';
|
|
|
- } else {
|
|
|
- return '未知';
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private function elapse_time($seconds)
|
|
|
{
|
|
|
$minutes = intval($seconds / 60);
|