商户配置
parent
ebabed1a15
commit
096e32d581
@ -0,0 +1,524 @@
|
||||
<?php
|
||||
|
||||
namespace Admin\Controller;
|
||||
|
||||
use User\Api\UserApi as UserApi;
|
||||
use Base\Service\PaymentMerchantService;
|
||||
use Base\Service\PaymentRuleService;
|
||||
use Base\Service\PromoteCompanyService;
|
||||
use Base\Service\GameService;
|
||||
use Think\Model;
|
||||
|
||||
/**
|
||||
* 支付/付款商户
|
||||
*/
|
||||
class PaymentMerchantController extends ThinkController
|
||||
{
|
||||
public function list()
|
||||
{
|
||||
$page = I('p', 1);
|
||||
$row = I('row', 10);
|
||||
$name = I('name', '');
|
||||
$mainName = I('main_name', '');
|
||||
$adminId = I('admin_id', 0);
|
||||
$channel = I('channel', 0);
|
||||
$way = I('way', 0);
|
||||
$status = I('status', -1);
|
||||
$startedAt = I('started_at', '1970-01-01');
|
||||
$endedAt = I('ended_at', '9999-01-01');
|
||||
|
||||
$conditions = [];
|
||||
if ($name != '') {
|
||||
$conditions['name'] = ['like', '%' . $name . '%'];
|
||||
}
|
||||
if ($mainName != '') {
|
||||
$conditions['main_name'] = ['like', '%' . $mainName . '%'];
|
||||
}
|
||||
if ($adminId != 0) {
|
||||
$conditions['admin_id'] = $adminId;
|
||||
}
|
||||
if ($channel != 0) {
|
||||
$conditions['channel'] = $channel;
|
||||
}
|
||||
if ($way != 0) {
|
||||
$conditions['_string'] = 'ways & ' . $way . '=' . $way;
|
||||
}
|
||||
if ($status != -1) {
|
||||
$conditions['status'] = $status;
|
||||
}
|
||||
|
||||
$conditions['update_time'] = ['between', [strtotime($startedAt . ' 00:00:00'), strtotime($endedAt . ' 23:59:59')]];
|
||||
|
||||
$paymentMerchantService = new PaymentMerchantService();
|
||||
|
||||
$query = M('payment_merchant', 'tab_')->where($conditions);
|
||||
$countQuery = clone $query;
|
||||
|
||||
$items = $query->order('id desc')->page($page, $row)->select();
|
||||
$count = $countQuery->count();
|
||||
|
||||
$admins = M('ucenter_member', 'sys_')->field(['id', 'username'])->select();
|
||||
$admins = index_by_column('id', $admins);
|
||||
|
||||
$records = [];
|
||||
foreach ($items as $item) {
|
||||
$records[] = [
|
||||
'id' => $item['id'],
|
||||
'name' => $item['name'],
|
||||
'main_name' => $item['main_name'],
|
||||
'account' => $item['account'],
|
||||
'status' => $item['status'],
|
||||
'channel' => $item['channel'],
|
||||
'wayNames' => implode('、', $paymentMerchantService->getWaysName($item['ways'])),
|
||||
'status_text' => $paymentMerchantService->getStatusText($item['status']),
|
||||
'channel_text' => $paymentMerchantService->getChannelText($item['channel']),
|
||||
'admin_username' => $admins[$item['admin_id']]['username'],
|
||||
'update_time' => date('Y-m-d H:i:s', $item['update_time']),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
$page = set_pagination($count, $row);
|
||||
if($page) {
|
||||
$this->assign('_page', $page);
|
||||
}
|
||||
|
||||
$aliDefaultMerchant = $paymentMerchantService->getDefault(PaymentMerchantService::WAY_ALIPAY);
|
||||
$weixinDefaultMerchant = $paymentMerchantService->getDefault(PaymentMerchantService::WAY_WEIXIN);
|
||||
$expressDefaultMerchant = $paymentMerchantService->getDefault(PaymentMerchantService::WAY_EXPRESS);
|
||||
$this->assign('aliDefaultMerchant', $aliDefaultMerchant);
|
||||
$this->assign('weixinDefaultMerchant', $weixinDefaultMerchant);
|
||||
$this->assign('expressDefaultMerchant', $expressDefaultMerchant);
|
||||
$this->assign('records', $records);
|
||||
$this->assign('admins', $admins);
|
||||
$this->assign('ways', PaymentMerchantService::$ways);
|
||||
$this->assign('statusList', PaymentMerchantService::$statusList);
|
||||
$this->assign('channels', PaymentMerchantService::$channels);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$this->meta_title = '添加商户';
|
||||
$this->assign('channels', PaymentMerchantService::$channels);
|
||||
$this->display('form');
|
||||
}
|
||||
|
||||
public function changeStatus()
|
||||
{
|
||||
$id = I('id', 0);
|
||||
$status = I('status', 0);
|
||||
$merchant = M('payment_merchant', 'tab_')->where(['id' => $id])->find();
|
||||
if (is_null($merchant)) {
|
||||
$this->ajaxReturn([
|
||||
'status' => 0,
|
||||
'message' => '记录不存在',
|
||||
]);
|
||||
}
|
||||
if (!in_array($status, [0, 1])) {
|
||||
$this->ajaxReturn([
|
||||
'status' => 0,
|
||||
'message' => '状态值错误',
|
||||
]);
|
||||
}
|
||||
$statusText = $status == 0 ? '禁用' : '启用';
|
||||
M('payment_merchant', 'tab_')->where(['id' => $id])->save(['status' => $status]);
|
||||
$this->ajaxReturn([
|
||||
'status' => 1,
|
||||
'message' => $statusText . '成功',
|
||||
]);
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$this->meta_title = '编辑商户';
|
||||
$id = I('id', 0);
|
||||
$merchant = M('payment_merchant', 'tab_')->where(['id' => $id])->find();
|
||||
if ($merchant == null) {
|
||||
$this->error('支付商户不存在');
|
||||
}
|
||||
$paymentMerchantService = new PaymentMerchantService();
|
||||
$config = $merchant['config'] ? json_decode($merchant['config'], true) : null;
|
||||
$ways = $paymentMerchantService->getWaysRow($merchant['ways']);
|
||||
$this->assign('channels', PaymentMerchantService::$channels);
|
||||
$this->assign('record', $merchant);
|
||||
$this->assign('config', $config);
|
||||
$this->assign('ways', $ways);
|
||||
$this->display('form');
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$id = I('id', 0);
|
||||
$name = I('name', '');
|
||||
$identifier = I('identifier', '');
|
||||
$channel = I('channel', 0);
|
||||
$status = I('status', 0);
|
||||
$account = I('account', '');
|
||||
$config = I('config', []);
|
||||
$ways = I('ways', []);
|
||||
$mainName = I('main_name', '');
|
||||
|
||||
if ($name == '') {
|
||||
$this->ajaxReturn([
|
||||
'status' => 0,
|
||||
'message' => '请输入商户名称',
|
||||
]);
|
||||
}
|
||||
if ($mainName == '') {
|
||||
$this->ajaxReturn([
|
||||
'status' => 0,
|
||||
'message' => '请输入商户商户主体',
|
||||
]);
|
||||
}
|
||||
if ($account == '') {
|
||||
$this->ajaxReturn([
|
||||
'status' => 0,
|
||||
'message' => '请输入商户账号',
|
||||
]);
|
||||
}
|
||||
|
||||
$merchant = null;
|
||||
if ($id > 0) {
|
||||
$merchant = M('payment_merchant', 'tab_')->where(['id' => $id])->find();
|
||||
if ($merchant == null) {
|
||||
$this->ajaxReturn([
|
||||
'status' => 0,
|
||||
'message' => '支付商户不存在',
|
||||
]);
|
||||
}
|
||||
}
|
||||
$paymentMerchantService = new PaymentMerchantService();
|
||||
$waysValue = $paymentMerchantService->getWaysValue($ways);
|
||||
|
||||
$userAuth = session('user_auth');
|
||||
|
||||
$data = [];
|
||||
$data['name'] = $name;
|
||||
$data['account'] = $account;
|
||||
$data['identifier'] = $identifier;
|
||||
$data['type'] = 1;
|
||||
$data['status'] = $status;
|
||||
$data['ways'] = $waysValue;
|
||||
$data['admin_id'] = $userAuth['uid'];
|
||||
$data['config'] = json_encode($config);
|
||||
$data['update_time'] = time();
|
||||
$data['main_name'] = $mainName;
|
||||
if ($id == 0) {
|
||||
$data['create_time'] = time();
|
||||
$data['channel'] = $channel;
|
||||
M('payment_merchant', 'tab_')->add($data);
|
||||
} else {
|
||||
M('payment_merchant', 'tab_')->where(['id' => $id])->save($data);
|
||||
}
|
||||
|
||||
$this->ajaxReturn([
|
||||
'status' => 1,
|
||||
'message' => '保存成功'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$id = I('id', 0);
|
||||
M('payment_merchant', 'tab_')->where(['id' => $id])->delete();
|
||||
|
||||
addOperationLog([
|
||||
'op_type' => 2,
|
||||
'key' => $id,
|
||||
'op_name' => '删除商户渠道',
|
||||
'url' => U('Market/delete', ['id' => $id]),
|
||||
'menu' => '推广员-推广员管理-市场换绑-删除商户渠道'
|
||||
]);
|
||||
|
||||
$this->ajaxReturn([
|
||||
'status' => 1,
|
||||
'message' => '删除成功'
|
||||
]);
|
||||
}
|
||||
|
||||
public function editDefault()
|
||||
{
|
||||
$paymentMerchantService = new PaymentMerchantService();
|
||||
$aliMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_ALIPAY);
|
||||
$weixinMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_WEIXIN);
|
||||
$expressMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_EXPRESS);
|
||||
$aliDefaultMerchant = $paymentMerchantService->getDefault(PaymentMerchantService::WAY_ALIPAY);
|
||||
$weixinDefaultMerchant = $paymentMerchantService->getDefault(PaymentMerchantService::WAY_WEIXIN);
|
||||
$expressDefaultMerchant = $paymentMerchantService->getDefault(PaymentMerchantService::WAY_EXPRESS);
|
||||
|
||||
$this->assign('aliDefaultMerchant', $aliDefaultMerchant);
|
||||
$this->assign('weixinDefaultMerchant', $weixinDefaultMerchant);
|
||||
$this->assign('expressDefaultMerchant', $expressDefaultMerchant);
|
||||
$this->assign('aliMerchants', $aliMerchants);
|
||||
$this->assign('weixinMerchants', $weixinMerchants);
|
||||
$this->assign('expressMerchants', $expressMerchants);
|
||||
$this->display('defaultForm');
|
||||
}
|
||||
|
||||
public function saveDefault()
|
||||
{
|
||||
$setting = I('setting', []);
|
||||
|
||||
$paymentMerchantService = new PaymentMerchantService();
|
||||
|
||||
$model = new Model();
|
||||
$model->startTrans();
|
||||
|
||||
try {
|
||||
foreach ($setting as $key => $value) {
|
||||
if ($key == 'alipay') {
|
||||
$paymentMerchantService->setDefault(PaymentMerchantService::WAY_ALIPAY, $value);
|
||||
} elseif ($key == 'weixin') {
|
||||
$paymentMerchantService->setDefault(PaymentMerchantService::WAY_WEIXIN, $value);
|
||||
} elseif ($key == 'express') {
|
||||
$paymentMerchantService->setDefault(PaymentMerchantService::WAY_EXPRESS, $value);
|
||||
}
|
||||
}
|
||||
$model->commit();
|
||||
|
||||
$this->ajaxReturn([
|
||||
'status' => 1,
|
||||
'message' => '设置成功'
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$model->rollback();
|
||||
|
||||
$this->ajaxReturn([
|
||||
'status' => 0,
|
||||
'message' => '设置失败,请联系管理员'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
$page = I('p', 1);
|
||||
$row = I('row', 10);
|
||||
$companyBelong = I('compnay_belong', -1);
|
||||
$companyId = I('company_id', 0);
|
||||
$gameTypeId = I('game_type_id', 0);
|
||||
$gameId = I('game_id', 0);
|
||||
$startedAt = I('started_at', '');
|
||||
$endedAt = I('ended_at', '');
|
||||
$alipayId = I('alipay_merchant_id', 0);
|
||||
$weixinId = I('weixin_merchant_id', 0);
|
||||
$expressId = I('express_merchant_id', 0);
|
||||
|
||||
$conditions = [];
|
||||
if ($companyBelong != -1) {
|
||||
$conditions['company_belong'] = $companyBelong;
|
||||
}
|
||||
if ($companyId != 0) {
|
||||
$conditions['company_id'] = $companyId;
|
||||
}
|
||||
if ($gameTypeId != 0) {
|
||||
$conditions['game_type_id'] = $gameTypeId;
|
||||
}
|
||||
if ($gameId != 0) {
|
||||
$conditions['game_id'] = $gameId;
|
||||
}
|
||||
if ($alipayId != 0) {
|
||||
$conditions['alipay_merchant_id'] = $alipayId;
|
||||
}
|
||||
if ($weixinId != 0) {
|
||||
$conditions['weixin_merchant_id'] = $weixinId;
|
||||
}
|
||||
if ($expressId != 0) {
|
||||
$conditions['express_merchant_id'] = $expressId;
|
||||
}
|
||||
if ($startedAt != '') {
|
||||
$conditions['update_time'] = ['egt', strtotime($startedAt . ' 00:00:00')];
|
||||
}
|
||||
if ($endedAt != '') {
|
||||
$conditions['update_time'] = ['elt', strtotime($endedAt . ' 23:59:59')];
|
||||
}
|
||||
|
||||
$paymentRuleService = new PaymentRuleService();
|
||||
$gameService = new GameService();
|
||||
$paymentMerchantService = new PaymentMerchantService();
|
||||
$companyService = new PromoteCompanyService();
|
||||
|
||||
$query = M('payment_rule', 'tab_')->where($conditions);
|
||||
$countQuery = clone $query;
|
||||
|
||||
$items = $query->order('id desc')->page($page, $row)->select();
|
||||
$count = $countQuery->count();
|
||||
|
||||
$gameTypes = $gameService->getGameTypes(null, 'id,type_name');
|
||||
$games = $gameService->getBaseGames(null, 'id,name');
|
||||
$companies = $companyService->getCompanies(null, 'id,company_name');
|
||||
$companyTypes = PromoteCompanyService::$belongs;
|
||||
$merchantIds = array_merge(
|
||||
array_column($items, 'alipay_merchant_id'),
|
||||
array_column($items, 'weixin_merchant_id'),
|
||||
array_column($items, 'express_merchant_id')
|
||||
);
|
||||
$merchants = $paymentMerchantService->getMerchantsByIds($merchantIds, 'id,channel,name,account');
|
||||
|
||||
$records = [];
|
||||
foreach ($items as $item) {
|
||||
$records[] = [
|
||||
'id' => $item['id'],
|
||||
'company_type_name' => $companyTypes[$item['company_belong']] ?? '无',
|
||||
'company_name' => isset($companies[$item['company_id']]) ? $companies[$item['company_id']]['company_name'] : '--',
|
||||
'game_name' => isset($games[$item['game_id']]) ? $games[$item['game_id']]['name'] : '--',
|
||||
'game_type_name' => isset($gameTypes[$item['game_type_id']]) ? $gameTypes[$item['game_type_id']]['type_name'] : '--',
|
||||
'alipay_merchant_name' => isset($merchants[$item['alipay_merchant_id']]) ? $merchants[$item['alipay_merchant_id']]['name'] : '系统默认商户',
|
||||
'alipay_merchant_account' => isset($merchants[$item['alipay_merchant_id']]) ? $merchants[$item['alipay_merchant_id']]['account'] : '系统默认商户',
|
||||
'weixin_merchant_name' => isset($merchants[$item['weixin_merchant_id']]) ? $merchants[$item['weixin_merchant_id']]['name'] : '系统默认商户',
|
||||
'weixin_merchant_account' => isset($merchants[$item['weixin_merchant_id']]) ? $merchants[$item['weixin_merchant_id']]['account'] : '系统默认商户',
|
||||
'express_merchant_name' => isset($merchants[$item['express_merchant_id']]) ? $merchants[$item['express_merchant_id']]['name'] : '系统默认商户',
|
||||
'express_merchant_account' => isset($merchants[$item['express_merchant_id']]) ? $merchants[$item['express_merchant_id']]['account'] : '系统默认商户',
|
||||
'effective_time_display' => $paymentRuleService->getEffectiveTimeDisplay($item)
|
||||
];
|
||||
}
|
||||
// var_dump($records);die();
|
||||
|
||||
$page = set_pagination($count, $row);
|
||||
if($page) {
|
||||
$this->assign('_page', $page);
|
||||
}
|
||||
|
||||
$aliMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_ALIPAY);
|
||||
$weixinMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_WEIXIN);
|
||||
$expressMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_EXPRESS);
|
||||
|
||||
$this->assign('aliMerchants', $aliMerchants);
|
||||
$this->assign('weixinMerchants', $weixinMerchants);
|
||||
$this->assign('expressMerchants', $expressMerchants);
|
||||
|
||||
$this->assign('records', $records);
|
||||
$this->assign('games', $games);
|
||||
$this->assign('gameTypes', $gameTypes);
|
||||
$this->assign('companyTypes', $companyTypes);
|
||||
$this->assign('companies', $companies);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function addRule()
|
||||
{
|
||||
$gameService = new GameService();
|
||||
$gameTypes = $gameService->getGameTypes(null, 'id,type_name');
|
||||
$games = $gameService->getBaseGames(null, 'id,name');
|
||||
$companyBelongs = PromoteCompanyService::$belongs;
|
||||
$companyService = new PromoteCompanyService();
|
||||
$paymentMerchantService = new PaymentMerchantService();
|
||||
$aliMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_ALIPAY);
|
||||
$weixinMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_WEIXIN);
|
||||
$expressMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_EXPRESS);
|
||||
$companies = $companyService->getCompanies(null, 'id,company_name');
|
||||
$this->assign('aliMerchants', $aliMerchants);
|
||||
$this->assign('weixinMerchants', $weixinMerchants);
|
||||
$this->assign('expressMerchants', $expressMerchants);
|
||||
$this->assign('games', $games);
|
||||
$this->assign('gameTypes', $gameTypes);
|
||||
$this->assign('companyBelongs', $companyBelongs);
|
||||
$this->assign('companies', $companies);
|
||||
$this->display('ruleAddForm');
|
||||
}
|
||||
|
||||
public function saveRule()
|
||||
{
|
||||
$records = I('records', []);
|
||||
if (count($records) == 0) {
|
||||
$this->ajaxReturn([
|
||||
'status' => 0,
|
||||
'message' => '未提交换绑数据'
|
||||
]);
|
||||
}
|
||||
|
||||
$status = true;
|
||||
$message = '';
|
||||
|
||||
if (!$status) {
|
||||
$this->ajaxReturn([
|
||||
'status' => 0,
|
||||
'message' => $message
|
||||
]);
|
||||
}
|
||||
|
||||
foreach ($records as $record) {
|
||||
$startTime = $record['start_time'] == '' ? 0 : strtotime($record['start_time'] . ' 00:00:00');
|
||||
$endTime = $record['end_time'] == '' ? 0 : strtotime($record['end_time'] . ' 23:59:59');
|
||||
$item = [
|
||||
'company_belong' => $record['company_id'] > 0 ? -1 : $record['company_belong'],
|
||||
'company_id' => $record['company_id'],
|
||||
'game_type_id' => $record['game_id'] > 0 ? 0 :$record['game_type_id'],
|
||||
'game_id' => $record['game_id'],
|
||||
'alipay_merchant_id' => $record['alipay_merchant_id'],
|
||||
'weixin_merchant_id' => $record['weixin_merchant_id'],
|
||||
'express_merchant_id' => $record['express_merchant_id'],
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
'create_time' => time(),
|
||||
'update_time' => time()
|
||||
];
|
||||
$id = M('payment_rule', 'tab_')->add($item);
|
||||
}
|
||||
|
||||
$this->ajaxReturn([
|
||||
'status' => 1,
|
||||
'message' => '添加成功'
|
||||
]);
|
||||
}
|
||||
|
||||
public function deleteRule()
|
||||
{
|
||||
$id = I('id', 0);
|
||||
M('payment_rule', 'tab_')->where(['id' => $id])->delete();
|
||||
|
||||
addOperationLog([
|
||||
'op_type' => 2,
|
||||
'key' => $id,
|
||||
'op_name' => '删除支付商户配置',
|
||||
'url' => U('PaymentMerchant/deleteRule', ['id' => $id]),
|
||||
'menu' => '推广员-推广员管理-市场换绑-删除支付商户配置'
|
||||
]);
|
||||
|
||||
$this->ajaxReturn([
|
||||
'status' => 1,
|
||||
'message' => '删除成功'
|
||||
]);
|
||||
}
|
||||
|
||||
public function getCompaniesByBelong()
|
||||
{
|
||||
$belong = I('company_belong', '');
|
||||
if ($belong === '') {
|
||||
$belong = null;
|
||||
}
|
||||
$promoteCompanyService = new PromoteCompanyService();
|
||||
$companies = $promoteCompanyService->getCompaniesByBelong($belong, 'id,company_name');
|
||||
|
||||
$this->ajaxReturn([
|
||||
'status' => 1,
|
||||
'message' => '获取成功',
|
||||
'data' => [
|
||||
'companies' => $companies
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function getGamesByType()
|
||||
{
|
||||
$gameTypeId = I('game_type_id', 0);
|
||||
$gameService = new GameService();
|
||||
$games = $gameService->getBaseGamesByType($gameTypeId, 'id,name');
|
||||
|
||||
$this->ajaxReturn([
|
||||
'status' => 1,
|
||||
'message' => '获取成功',
|
||||
'data' => [
|
||||
'games' => $games
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function checkRules()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,160 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
|
||||
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
|
||||
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
|
||||
|
||||
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/select2.min.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
|
||||
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<style>
|
||||
html {
|
||||
min-width:100%;
|
||||
}
|
||||
body {
|
||||
padding: 0px;
|
||||
}
|
||||
table{
|
||||
|
||||
margin: auto;
|
||||
}
|
||||
.hidebox{
|
||||
display: none;
|
||||
}
|
||||
.r{
|
||||
width: 300px;
|
||||
}
|
||||
.l{
|
||||
width: 180px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single {
|
||||
color: #000;
|
||||
resize: none;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
|
||||
box-shadow: 0px 3px 3px #F7F8F9 inset;
|
||||
height: 35px;
|
||||
height: 28px;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
line-height: 35px;
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height: 26px;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.select2-results__option[aria-selected] {
|
||||
font-size: 12px;
|
||||
}
|
||||
.input-list, .i_list {
|
||||
float: left;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
|
||||
<!-- 标签页导航 -->
|
||||
<div class="tab-wrap">
|
||||
<div class="tab-content tabcon1711">
|
||||
<!-- 表单 -->
|
||||
<form id="form" action="{:U('saveDefault')}" method="post" class="form-horizontal">
|
||||
<!-- 基础文档模型 -->
|
||||
<div id="tab1" class="tab-pane in tab1">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>支付宝支付配置:</td>
|
||||
<td class="r">
|
||||
<select name="setting[alipay]" id="alipay-merchant-select" class="select_gallery">
|
||||
<option value="0">请选择支付宝支付配置</option>
|
||||
<?php foreach($aliMerchants as $merchant):?>
|
||||
<option value="<?=$merchant['id']?>" <?php if($aliDefaultMerchant['id']==$merchant['id']):?>selected<?php endif;?>><?=$merchant['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>微信支付配置:</td>
|
||||
<td class="r">
|
||||
<select name="setting[weixin]" id="weixin-merchant-select" class="select_gallery">
|
||||
<option value="0">请选择微信支付配置</option>
|
||||
<?php foreach($weixinMerchants as $merchant):?>
|
||||
<option value="<?=$merchant['id']?>" <?php if($weixinDefaultMerchant['id']==$merchant['id']):?>selected<?php endif;?>><?=$merchant['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>快捷支付配置:</td>
|
||||
<td class="r">
|
||||
<select name="setting[express]" id="express-merchant-select" class="select_gallery">
|
||||
<option value="0">请选择快捷支付配置</option>
|
||||
<?php foreach($expressMerchants as $merchant):?>
|
||||
<option value="<?=$merchant['id']?>" <?php if($expressDefaultMerchant['id']==$merchant['id']):?>selected<?php endif;?>><?=$merchant['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="form-item cf">
|
||||
<button class="submit_btn mlspacing" id="submit" type="submit" target-form="form-horizontal" style="margin-left: 193px">
|
||||
确认
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(".select_gallery").select2();
|
||||
|
||||
$(function(){
|
||||
|
||||
$('#submit').click(function (e) {
|
||||
var target = $('form').get(0).action;
|
||||
var query = $('form').serialize();
|
||||
var that = this;
|
||||
$(that).addClass('disabled').attr('autocomplete','off').prop('disabled',true);
|
||||
$.post(target,query).success(function(result){
|
||||
if(layer) { layer.closeAll('loading'); }
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message)
|
||||
setTimeout(function(){
|
||||
parent.location.reload()
|
||||
},350)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,384 @@
|
||||
<extend name="Public/base"/>
|
||||
<block name="css">
|
||||
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="__CSS__/promote.css" type="text/css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
|
||||
<style>
|
||||
.select2-container--default .select2-selection--single {
|
||||
color: #000;
|
||||
resize: none;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
|
||||
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
|
||||
height:28px;border-radius:3px;font-size:12px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
line-height:35px;
|
||||
line-height:28px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height:26px;
|
||||
}
|
||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||
height:26px;line-height:26px;font-size:12px;
|
||||
}
|
||||
.select2-results__option[aria-selected] {font-size:12px;}
|
||||
.textarea-style {
|
||||
width: 200px;
|
||||
height: 80px;
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
.mustmark {
|
||||
color: #FF0000;
|
||||
font-style: normal;
|
||||
margin: 0 3px;
|
||||
}
|
||||
.el-card {
|
||||
border-radius: 4px;
|
||||
border: 1px solid #ebeef5;
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
color: #303133;
|
||||
transition: .3s;
|
||||
}
|
||||
.el-card .card-body {
|
||||
padding: 20px;
|
||||
}
|
||||
.el-card .card-header {
|
||||
padding: 18px 20px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.clearfix:after {
|
||||
content:"";
|
||||
display: block;
|
||||
clear:both;
|
||||
}
|
||||
.set-default-btn {
|
||||
border: none;
|
||||
background: #3C95C8;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
border-radius: 3px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
border-bottom: none;
|
||||
width: 55px;
|
||||
height: 28px;
|
||||
line-height: 26px;
|
||||
}
|
||||
</style>
|
||||
</block>
|
||||
<block name="body">
|
||||
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/select2.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/jquery.form.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
|
||||
|
||||
<script src="__STATIC__/md5.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="__STATIC__/webuploader/webuploader.js"></script>
|
||||
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
|
||||
<div class="cf clearfix main-place top_nav_list navtab_list">
|
||||
<h3 class="page_title">支付配置列表</h3>
|
||||
</div>
|
||||
<div class="cf clearfix top_nav_list">
|
||||
<!-- 高级搜索 -->
|
||||
<div class="jssearch fl cf search_list">
|
||||
<div class="input-list search-title-box">
|
||||
<label>搜索:</label>
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<input type="text" name="name" placeholder="请输入支付配置名称" class="" value="" style="width: 150px">
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<input type="text" name="main_name" placeholder="请输入商户主体" class="" value="" style="width: 150px">
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<select id="channel_select" name="channel" class="select_gallery" style="width:200px;">
|
||||
<option value="0">请选择支付渠道</option>
|
||||
<?php foreach($channels as $key => $name):?>
|
||||
<option value="<?=$key?>"><?=$name?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select id="status_select" name="status" class="select_gallery" style="width:200px;">
|
||||
<option value="-1">请选择状态</option>
|
||||
<?php foreach($statusList as $key => $name):?>
|
||||
<option value="<?=$key?>"><?=$name?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select id="way_select" name="way" class="select_gallery" style="width:200px;">
|
||||
<option value="0">请选择支付方式</option>
|
||||
<?php foreach($ways as $key => $name):?>
|
||||
<option value="<?=$key?>"><?=$name?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select id="admin-select" name="admin_id" class="select_gallery" style="width:200px;">
|
||||
<option value="">请选择操作管理员</option>
|
||||
<?php foreach($admins as $admin):?>
|
||||
<option value="<?=$admin['id']?>"><?=$admin['username']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<input type="text" id="started_at" name="started_at" class="time" value="" placeholder="操作开始时间" autocomplete="off" />
|
||||
-
|
||||
<div class="input-append date" id="datetimepicker" style="display:inline-block">
|
||||
<input type="text" id="ended_at" name="ended_at" class="time" value="" placeholder="操作结束时间" autocomplete="off" />
|
||||
<span class="add-on"><i class="icon-th"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<a class="sch-btn" href="javascript:;" id="search" url="{:U('PaymentMerchant/list')}">搜索</a>
|
||||
<a class="sch-btn" style="width: 80px;" href="{:U('PaymentMerchant/add')}">新增商户</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="el-card" style="width: 100%; margin-bottom: 10px;">
|
||||
<div class="card-body">
|
||||
<div class="default-setting">
|
||||
<div class="title" style="display: inline-block; font-weight: 600;">当前系统默认设置 </div>
|
||||
<div class="item" style="display: inline-block;margin-left: 15px;">
|
||||
支付宝:<?=$aliDefaultMerchant ? $aliDefaultMerchant['name'] : '无' ?>
|
||||
</div>
|
||||
<div class="item" style="display: inline-block;margin-left: 15px;">
|
||||
微信:<?=$weixinDefaultMerchant ? $weixinDefaultMerchant['name'] : '无' ?>
|
||||
</div>
|
||||
<div class="item" style="display: inline-block;margin-left: 15px;">
|
||||
快捷支付:<?=$expressDefaultMerchant ? $expressDefaultMerchant['name'] : '无' ?>
|
||||
</div>
|
||||
<div style="display: inline-block;margin-left: 15px;">
|
||||
<button id="set-default-btn" class="set-default-btn">设置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 数据列表 -->
|
||||
<div class="data_list">
|
||||
<div class="">
|
||||
<table>
|
||||
<!-- 表头 -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th>商户名称</th>
|
||||
<th>商户主体</th>
|
||||
<th>支付渠道</th>
|
||||
<th>商户账户</th>
|
||||
<th>支持支付方式</th>
|
||||
<th>状态</th>
|
||||
<th>操作管理员</th>
|
||||
<th>操作时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<!-- 列表 -->
|
||||
<tbody>
|
||||
<empty name ="records">
|
||||
<td colspan="9" class="text-center">aOh! 暂时还没有内容!</td>
|
||||
<else />
|
||||
<volist name="records" id="data">
|
||||
<tr data-id="<?=$data['id']?>">
|
||||
<td>{$data.name}</td>
|
||||
<td>{$data.main_name}</td>
|
||||
<td>{$data.channel_text}</td>
|
||||
<td>{$data.account}</td>
|
||||
<td>{$data.wayNames}</td>
|
||||
<td>
|
||||
<?php if($data['status'] == 0):?>
|
||||
<span style="color: #ff0000;">{$data.status_text}</span>
|
||||
<?php else:?>
|
||||
<span>{$data.status_text}</span>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
<td>{$data.admin_username}</td>
|
||||
<td>{$data.update_time}</td>
|
||||
<td>
|
||||
<div class="partakebtn">
|
||||
<a href="<?=U('edit', ['id' => $data['id']])?>">编辑</a>
|
||||
<?php if($data['status'] == 0):?>
|
||||
<a class="status-btn" data-status="1">启用</a>
|
||||
<?php else:?>
|
||||
<a class="status-btn" data-status="0" style="color: #ff0000;">禁用</a>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</volist>
|
||||
</empty>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page">
|
||||
<if condition="$role_export_check eq true ">
|
||||
<!-- <a class="sch-btn export-btn"
|
||||
href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a> -->
|
||||
</if>
|
||||
{$_page|default=''}
|
||||
</div>
|
||||
|
||||
<div class="common_settings">
|
||||
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
|
||||
<form class="addShortcutIcon">
|
||||
<input type="hidden" name="title" value="{$m_title}">
|
||||
<input type="hidden" name="url" value="Query/withdraw">
|
||||
</form>
|
||||
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
|
||||
</div>
|
||||
</block>
|
||||
|
||||
<block name="script">
|
||||
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
|
||||
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
|
||||
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
|
||||
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
|
||||
|
||||
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
|
||||
<script src="__STATIC__/jquery.cookie.js" charset="utf-8"></script>
|
||||
<script>
|
||||
<volist name=":I('get.')" id="vo">
|
||||
Think.setValue('{$key}',"{$vo}");
|
||||
</volist>
|
||||
$(".select_gallery").select2();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
//导航高亮
|
||||
highlight_subnav("{:U('Market/rebindRecords')}");
|
||||
$(function(){
|
||||
//搜索功能
|
||||
$("#search").click(function(){
|
||||
var url = $(this).attr('url');
|
||||
var query = $('.jssearch').find('input').serialize();
|
||||
query += "&"+$('.jssearch').find('select').serialize();
|
||||
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
|
||||
query = query.replace(/^&/g,'');
|
||||
if( url.indexOf('?')>0 ){
|
||||
url += '&' + query;
|
||||
}else{
|
||||
url += '?' + query;
|
||||
}
|
||||
window.location.href = url;
|
||||
});
|
||||
//回车自动提交
|
||||
$('.jssearch').find('input').keyup(function(event){
|
||||
if(event.keyCode===13){
|
||||
$("#search").click();
|
||||
}
|
||||
})
|
||||
|
||||
$('.time').datetimepicker({
|
||||
format: 'yyyy-mm-dd',
|
||||
language: "zh-CN",
|
||||
autoclose: true,
|
||||
scrollMonth: false,
|
||||
scrollTime: false,
|
||||
scrollInput: false,
|
||||
startView: 'month',
|
||||
minView:'month',
|
||||
maxView:'month',
|
||||
});
|
||||
|
||||
$('#batch-delete-btn').on({
|
||||
click: function() {
|
||||
var ids = getIds();
|
||||
$.ajax({
|
||||
url: '{:U("batchDelete")}',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {ids: ids},
|
||||
success: function(result) {
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message)
|
||||
setTimeout(function() {
|
||||
window.location.href = window.location.href
|
||||
}, 200)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
function getIds() {
|
||||
var ids = [];
|
||||
$('.ids:checked').each(function() {
|
||||
ids.push($(this).val());
|
||||
})
|
||||
return ids;
|
||||
}
|
||||
$('.delete-btn').on({
|
||||
click: function() {
|
||||
var id = $(this).parents('tr').eq(0).attr('data-id');
|
||||
$.ajax({
|
||||
url: '{:U("delete")}',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {id: id},
|
||||
success: function(result) {
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message)
|
||||
setTimeout(function() {
|
||||
window.location.href = window.location.href
|
||||
}, 200)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
$('.status-btn').on({
|
||||
click: function() {
|
||||
var id = $(this).parents('tr').eq(0).attr('data-id')
|
||||
var status = $(this).attr('data-status')
|
||||
$.ajax({
|
||||
url: '{:U("changeStatus")}',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: { id: id, status: status },
|
||||
success: function(result) {
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message)
|
||||
setTimeout(function() {
|
||||
window.location.href = window.location.href
|
||||
}, 200)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
$('#set-default-btn').on({
|
||||
click: function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: "设置系统默认",
|
||||
shadeClose: true,
|
||||
shade: 0.8,
|
||||
area: ['500px', '300px'],
|
||||
// content:'/admin.php?s=/AggregateFinanceStatement/viewStatement/id/'+1
|
||||
content: '/admin.php?s=/PaymentMerchant/editDefault'
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
/* $(".export-btn").on("click",function(e){
|
||||
e.preventDefault();
|
||||
window.location.href=$(this).attr("href")
|
||||
}) */
|
||||
</script>
|
||||
</block>
|
@ -0,0 +1,508 @@
|
||||
<extend name="Public/base" />
|
||||
|
||||
<block name="body">
|
||||
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
|
||||
<link href="__STATIC__/icons_alibaba/iconfont.css" rel="stylesheet">
|
||||
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/provincecityarea/AreaData_min.js"></script>
|
||||
<script src="__STATIC__/layer/layer.js"></script>
|
||||
<script type="text/javascript" src="__JS__/select2.min.js"></script>
|
||||
|
||||
<style>
|
||||
.tabcon1711 input.time {
|
||||
width: 150px;
|
||||
}
|
||||
#form .txt_area {
|
||||
width: 300px;
|
||||
height: 150px;
|
||||
}
|
||||
.tabcon1711 .form_unit {
|
||||
margin-left: 2px;
|
||||
}
|
||||
.tabcon1711 .mustmark {
|
||||
margin-left:-7px;
|
||||
}
|
||||
.list-ratio {
|
||||
display: table;
|
||||
}
|
||||
.list-ratio .li-ratio {
|
||||
display: flex;
|
||||
margin-bottom: 20px;
|
||||
align-items: center;
|
||||
}
|
||||
.list-ratio .li-ratio .turnover, .list-ratio .li-ratio .turnover-ratio {
|
||||
position: relative;
|
||||
}
|
||||
.list-ratio .li-ratio .turnover span, .list-ratio .li-ratio .turnover-ratio .error-message {
|
||||
color: red;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 30px;
|
||||
white-space: nowrap;
|
||||
display: none;
|
||||
}
|
||||
.iconfont-btn {
|
||||
cursor: pointer;
|
||||
}
|
||||
.iconfont-style {
|
||||
font-size: 18px;
|
||||
color: #fff;
|
||||
border-radius: 4px;
|
||||
border: 0;
|
||||
padding: 5px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.iconfont-selected {
|
||||
background-color: #0A9AF2;
|
||||
}
|
||||
.iconfont-selected:hover {
|
||||
background-color: #03a9f4;
|
||||
}
|
||||
.iconfont-unselected {
|
||||
background-color: #999;
|
||||
}
|
||||
.iconfont-unselected:hover {
|
||||
background-color: #ababab;
|
||||
}
|
||||
.tabcon1711 .submit_btn.small-btn {
|
||||
float: none;
|
||||
line-height: 25px;
|
||||
width: 50px;
|
||||
height: 25px;
|
||||
font-size: 12px;
|
||||
padding: 0px 8px 0px 0px;
|
||||
}
|
||||
.select2-container--default .select2-selection--multiple {
|
||||
line-height: 22px;
|
||||
}
|
||||
.select2-container .select2-search--inline {
|
||||
float: left;
|
||||
height: 29px;
|
||||
line-height: 29px;
|
||||
}
|
||||
.select2-container--default .select2-search--inline .select2-search__field {
|
||||
height: 22px;
|
||||
}
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
}
|
||||
</style>
|
||||
<div class="cf main-place top_nav_list navtab_list">
|
||||
<h3 class="page_title">{$meta_title}</h3>
|
||||
<!-- <p class="description_text">说明:此功是创建推广员时所需填写信息</p>-->
|
||||
</div>
|
||||
|
||||
<!-- 标签页导航 -->
|
||||
<div class="tab-wrap">
|
||||
<div class="tab-content tabcon1711">
|
||||
<!-- 表单 -->
|
||||
<form id="form" method="post" class="form-horizontal" style="margin-bottom: 40px;">
|
||||
<!-- 基础文档模型 -->
|
||||
<div id="tab1" class="tab-pane in tab1">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>公司类型:</td>
|
||||
<td class="r">
|
||||
<select name="company_belong" id="company-belong-select" class="select_gallery">
|
||||
<option value="-1">所有公司类型</option>
|
||||
<?php foreach($companyBelongs as $key => $name):?>
|
||||
<option value="<?=$key?>"><?=$name?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>推广公司:</td>
|
||||
<td class="r">
|
||||
<select name="company_id[]" id="company-select" class="select_gallery" multiple="multiple" style="width: 500px;">
|
||||
<option value="0">所有公司</option>
|
||||
<?php foreach($companies as $company):?>
|
||||
<option value="<?=$company['id']?>"><?=$company['company_name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>游戏类型:</td>
|
||||
<td class="r">
|
||||
<select name="game_type_id" id="game-type-select" class="select_gallery">
|
||||
<option value="0">所有游戏类型</option>
|
||||
<?php foreach($gameTypes as $gameType):?>
|
||||
<option value="<?=$gameType['id']?>"><?=$gameType['type_name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>游戏:</td>
|
||||
<td class="r">
|
||||
<select name="game_id" id="game-select" class="select_gallery" multiple="multiple" style="width: 500px;">
|
||||
<option value="0">所有择游戏</option>
|
||||
<?php foreach($games as $game):?>
|
||||
<option value="<?=$game['id']?>"><?=$game['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>支付宝支付配置:</td>
|
||||
<td class="r">
|
||||
<select name="alipay_merchant_id" id="alipay-merchant-select" class="select_gallery">
|
||||
<option value="0">跟随系统默认商户</option>
|
||||
<?php foreach($aliMerchants as $merchant):?>
|
||||
<option value="<?=$merchant['id']?>"><?=$merchant['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>微信支付配置:</td>
|
||||
<td class="r">
|
||||
<select name="weixin_merchant_id" id="weixin-merchant-select" class="select_gallery">
|
||||
<option value="0">跟随系统默认商户</option>
|
||||
<?php foreach($weixinMerchants as $merchant):?>
|
||||
<option value="<?=$merchant['id']?>"><?=$merchant['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>快捷支付配置:</td>
|
||||
<td class="r">
|
||||
<select name="express_merchant_id" id="express-merchant-select" class="select_gallery">
|
||||
<option value="0">跟随系统默认商户</option>
|
||||
<?php foreach($expressMerchants as $merchant):?>
|
||||
<option value="<?=$merchant['id']?>"><?=$merchant['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l">生效时间(开始):</td>
|
||||
<td class="r">
|
||||
<input type="text" id="start_time" name="start_time" class="time" value="" autocomplete="off" placeholder="请选择生效时间(开始)" style="width: 200px"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l">生效时间(结束):</td>
|
||||
<td class="r">
|
||||
<input type="text" id="end_time" name="end_time" class="time" value="" autocomplete="off" placeholder="请选择生效时间(开始)" style="width: 200px"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="form-item cf">
|
||||
<button class="submit_btn mlspacing" id="add-item" type="button" target-form="form-horizontal" style="margin-top: 10px;">
|
||||
新增
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="data_list">
|
||||
<div class="">
|
||||
<table id="record-table">
|
||||
<!-- 表头 -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th>公司类型</th>
|
||||
<th>推广公司</th>
|
||||
<th>游戏类型</th>
|
||||
<th>游戏产品</th>
|
||||
<th>支付宝支付配置</th>
|
||||
<th>微信支付配置</th>
|
||||
<th>快捷支付配置</th>
|
||||
<th>生效时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<!-- 列表 -->
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 30px; height: 35px; width: 100%;">
|
||||
<a class="submit_btn" href="javascript:;" id="submit" style="margin: 0px auto; margin-left: 208px; ">全部提交</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="common_settings">
|
||||
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
|
||||
<form class="addShortcutIcon">
|
||||
<input type="hidden" name="title" value="{$m_title}">
|
||||
<input type="hidden" name="url" value="Promote/lists/type/1">
|
||||
</form>
|
||||
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
|
||||
</div>
|
||||
|
||||
</block>
|
||||
|
||||
<block name="script">
|
||||
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
|
||||
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
|
||||
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
|
||||
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
|
||||
<script type="text/javascript">
|
||||
//导航高亮
|
||||
highlight_subnav("{:U('Market/rebindRecords')}");
|
||||
$(".select_gallery").select2();
|
||||
|
||||
$(function(){
|
||||
$('.time').datetimepicker({
|
||||
format: 'yyyy-mm-dd',
|
||||
language: "zh-CN",
|
||||
autoclose: true,
|
||||
scrollMonth: false,
|
||||
scrollTime: false,
|
||||
scrollInput: false,
|
||||
startView: 'month',
|
||||
minView:'month',
|
||||
maxView:'month',
|
||||
});
|
||||
showTab();
|
||||
$('#company-belong-select').on({
|
||||
change: function() {
|
||||
var companyBelong = $(this).val()
|
||||
getCompaniesByBelong(companyBelong, function(companies) {
|
||||
var html = '<option value="">所有推广公司</option>'
|
||||
for (var key in companies) {
|
||||
html += '<option value="' +
|
||||
companies[key].id +
|
||||
'">' + companies[key].company_name + '</option>'
|
||||
}
|
||||
$('#company-select').html(html)
|
||||
$('#company-select').select2()
|
||||
})
|
||||
}
|
||||
})
|
||||
$('#game-type-select').on({
|
||||
change: function() {
|
||||
var gameTypeId = $(this).val()
|
||||
getGamesByType(gameTypeId, function(games) {
|
||||
var html = '<option value="">所有游戏</option>'
|
||||
for (var key in games) {
|
||||
html += '<option value="' +
|
||||
games[key].id +
|
||||
'">' + games[key].name + '</option>'
|
||||
}
|
||||
$('#game-select').html(html)
|
||||
$('#game-select').select2()
|
||||
})
|
||||
}
|
||||
})
|
||||
function getCompaniesByBelong(companyBelong, callback) {
|
||||
$.ajax({
|
||||
url: '{:U("getCompaniesByBelong")}',
|
||||
type: 'get',
|
||||
dataType: 'json',
|
||||
data: {company_belong: companyBelong},
|
||||
success: function(result) {
|
||||
if (result.status == 1) {
|
||||
callback(result.data.companies)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
function getGamesByType(gameTypeId, callback) {
|
||||
$.ajax({
|
||||
url: '{:U("getGamesByType")}',
|
||||
type: 'get',
|
||||
dataType: 'json',
|
||||
data: {game_type_id: gameTypeId},
|
||||
success: function(result) {
|
||||
if (result.status == 1) {
|
||||
callback(result.data.games)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function descartes(list) {
|
||||
//parent上一级索引;count指针计数
|
||||
var point = {};
|
||||
|
||||
var result = [];
|
||||
var pIndex = null;
|
||||
var tempCount = 0;
|
||||
var temp = [];
|
||||
|
||||
//根据参数列生成指针对象
|
||||
for(var index in list) {
|
||||
if(typeof list[index] == 'object') {
|
||||
point[index] = {'parent':pIndex,'count':0}
|
||||
pIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
//单维度数据结构直接返回
|
||||
if(pIndex == null) {
|
||||
return list;
|
||||
}
|
||||
|
||||
//动态生成笛卡尔积
|
||||
while(true) {
|
||||
for(var index in list) {
|
||||
tempCount = point[index]['count'];
|
||||
temp.push(list[index][tempCount]);
|
||||
}
|
||||
|
||||
//压入结果数组
|
||||
result.push(temp);
|
||||
temp = [];
|
||||
|
||||
//检查指针最大值问题
|
||||
while(true) {
|
||||
if(point[index]['count']+1 >= list[index].length) {
|
||||
point[index]['count'] = 0;
|
||||
pIndex = point[index]['parent'];
|
||||
if(pIndex == null) {
|
||||
return result;
|
||||
}
|
||||
//赋值parent进行再次检查
|
||||
index = pIndex;
|
||||
} else {
|
||||
point[index]['count']++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getRangeTimeDisplay(startTime, endTime)
|
||||
{
|
||||
if (startTime === '' && endTime === '') {
|
||||
return '永久';
|
||||
}
|
||||
if (startTime !== '' && endTime !== '') {
|
||||
return startTime + ' 至 ' + endTime;
|
||||
}
|
||||
if (startTime === '' && endTime !== '') {
|
||||
return '从前 至 ' + endTime;
|
||||
}
|
||||
if (startTime !== '' && endTime === '') {
|
||||
return startTime + ' 至 永久';
|
||||
}
|
||||
}
|
||||
|
||||
function getCompanyName(id) {
|
||||
return $("#company-select option[value=" + id + "]").html();
|
||||
}
|
||||
|
||||
function getGameName(id) {
|
||||
return $("#game-select option[value=" + id + "]").html();
|
||||
}
|
||||
|
||||
$('#add-item').on({
|
||||
click: function () {
|
||||
var companySelect = $("#company-select");
|
||||
var companyIds = companySelect.val()
|
||||
|
||||
var companyBelongOption = $("#company-belong-select option:selected");
|
||||
var companyBelongId = companyBelongOption.val()
|
||||
var companyBelongName = companyBelongOption.text()
|
||||
|
||||
var gameTypeOption = $("#game-type-select option:selected");
|
||||
var gameTypeId = gameTypeOption.val()
|
||||
var gameTypeName = gameTypeOption.text()
|
||||
|
||||
var gameSelect = $("#game-select");
|
||||
var gameIds = gameSelect.val()
|
||||
|
||||
var alipayOption = $("#alipay-merchant-select option:selected");
|
||||
var alipayId = alipayOption.val()
|
||||
var alipayName = alipayOption.text()
|
||||
|
||||
var weixinOption = $("#weixin-merchant-select option:selected");
|
||||
var weixinId = weixinOption.val()
|
||||
var weixinName = weixinOption.text()
|
||||
|
||||
var expressOption = $("#express-merchant-select option:selected");
|
||||
var expressId = expressOption.val()
|
||||
var expressName = expressOption.text()
|
||||
|
||||
var startTime = $("#start_time").val();
|
||||
var endTime = $("#end_time").val();
|
||||
|
||||
var items = descartes([
|
||||
[companyBelongId], companyIds, [gameTypeId], gameIds
|
||||
])
|
||||
|
||||
/* if (companyId == '') {
|
||||
return layer.msg('请选择推广公司')
|
||||
}
|
||||
if (promoteId == '') {
|
||||
return layer.msg('请选择会长')
|
||||
}
|
||||
if (marketId == '') {
|
||||
return layer.msg('请新市场专员')
|
||||
}
|
||||
if (promoteIds.includes(promoteId)) {
|
||||
return layer.msg('该会长已添加')
|
||||
} */
|
||||
|
||||
for (var i in items) {
|
||||
var data = {
|
||||
company_belong: items[i][0],
|
||||
company_id: items[i][1],
|
||||
game_type_id: items[i][2],
|
||||
game_id: items[i][3],
|
||||
alipay_merchant_id: alipayId,
|
||||
weixin_merchant_id: weixinId,
|
||||
express_merchant_id: expressId,
|
||||
start_time: startTime,
|
||||
end_time: endTime,
|
||||
}
|
||||
var html = '<tr data-post=' + JSON.stringify(data) + '><td>' + companyBelongName + '</td>' +
|
||||
'<td>' + getCompanyName(items[i][1]) + '</td>' +
|
||||
'<td>' + gameTypeName + '</td>' +
|
||||
'<td>' + getGameName(items[i][3]) + '</td>' +
|
||||
'<td>' + alipayName + '</td>' +
|
||||
'<td>' + weixinName + '</td>' +
|
||||
'<td>' + expressName + '</td>' +
|
||||
'<td>' + getRangeTimeDisplay(startTime, endTime) + '</td>' +
|
||||
'<td><a class="delete-btn">删除</a></td>' +
|
||||
'</tr>';
|
||||
$('#record-table').find('tbody').append(html);
|
||||
}
|
||||
}
|
||||
})
|
||||
$('#record-table').on('click', '.delete-btn', function() {
|
||||
var tr = $(this).parents('tr').eq(0)
|
||||
tr.remove()
|
||||
})
|
||||
|
||||
$('#submit').click(function (e) {
|
||||
var records = []
|
||||
$('#record-table').find('tbody').children('tr').each(function() {
|
||||
records.push(JSON.parse($(this).attr('data-post')))
|
||||
})
|
||||
$.ajax({
|
||||
url: '{:U("saveRule")}',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {records: records},
|
||||
success: function(result) {
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message)
|
||||
setTimeout(function() {
|
||||
window.location.href = '{:U("rules")}'
|
||||
}, 200)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</block>
|
@ -0,0 +1,328 @@
|
||||
<extend name="Public/base" />
|
||||
|
||||
<block name="body">
|
||||
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
|
||||
<link href="__STATIC__/icons_alibaba/iconfont.css" rel="stylesheet">
|
||||
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/provincecityarea/AreaData_min.js"></script>
|
||||
<script src="__STATIC__/layer/layer.js"></script>
|
||||
<script type="text/javascript" src="__JS__/select2.min.js"></script>
|
||||
|
||||
<style>
|
||||
.tabcon1711 input.time {
|
||||
width: 150px;
|
||||
}
|
||||
#form .txt_area {
|
||||
width: 300px;
|
||||
height: 150px;
|
||||
}
|
||||
.tabcon1711 .form_unit {
|
||||
margin-left: 2px;
|
||||
}
|
||||
.tabcon1711 .mustmark {
|
||||
margin-left:-7px;
|
||||
}
|
||||
.list-ratio {
|
||||
display: table;
|
||||
}
|
||||
.list-ratio .li-ratio {
|
||||
display: flex;
|
||||
margin-bottom: 20px;
|
||||
align-items: center;
|
||||
}
|
||||
.list-ratio .li-ratio .turnover, .list-ratio .li-ratio .turnover-ratio {
|
||||
position: relative;
|
||||
}
|
||||
.list-ratio .li-ratio .turnover span, .list-ratio .li-ratio .turnover-ratio .error-message {
|
||||
color: red;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 30px;
|
||||
white-space: nowrap;
|
||||
display: none;
|
||||
}
|
||||
.iconfont-btn {
|
||||
cursor: pointer;
|
||||
}
|
||||
.iconfont-style {
|
||||
font-size: 18px;
|
||||
color: #fff;
|
||||
border-radius: 4px;
|
||||
border: 0;
|
||||
padding: 5px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.iconfont-selected {
|
||||
background-color: #0A9AF2;
|
||||
}
|
||||
.iconfont-selected:hover {
|
||||
background-color: #03a9f4;
|
||||
}
|
||||
.iconfont-unselected {
|
||||
background-color: #999;
|
||||
}
|
||||
.iconfont-unselected:hover {
|
||||
background-color: #ababab;
|
||||
}
|
||||
.tabcon1711 .submit_btn.small-btn {
|
||||
float: none;
|
||||
line-height: 25px;
|
||||
width: 50px;
|
||||
height: 25px;
|
||||
font-size: 12px;
|
||||
padding: 0px 8px 0px 0px;
|
||||
}
|
||||
.select2-container--default .select2-selection--multiple {
|
||||
line-height: 22px;
|
||||
}
|
||||
.select2-container .select2-search--inline {
|
||||
float: left;
|
||||
height: 29px;
|
||||
line-height: 29px;
|
||||
}
|
||||
.select2-container--default .select2-search--inline .select2-search__field {
|
||||
height: 22px;
|
||||
}
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
}
|
||||
</style>
|
||||
<div class="cf main-place top_nav_list navtab_list">
|
||||
<h3 class="page_title">{$meta_title}</h3>
|
||||
<!-- <p class="description_text">说明:此功是创建推广员时所需填写信息</p>-->
|
||||
</div>
|
||||
|
||||
<!-- 标签页导航 -->
|
||||
<div class="tab-wrap">
|
||||
<div class="tab-content tabcon1711">
|
||||
<!-- 表单 -->
|
||||
<form id="form" action="{:U('modifyRule')}" method="post" class="form-horizontal">
|
||||
<!-- 基础文档模型 -->
|
||||
<div id="tab1" class="tab-pane in tab1">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>公司类型:</td>
|
||||
<td class="r">
|
||||
<select name="company_belong" id="company-belong-select" class="select_gallery" disabled>
|
||||
<option value="-1">所有公司类型</option>
|
||||
<?php foreach($companyBelongs as $key => $name):?>
|
||||
<option value="<?=$key?>" <?php if($record['company_belong']==$key):?>select<?php endif;?>><?=$name?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>推广公司:</td>
|
||||
<td class="r">
|
||||
<select name="company_id[]" id="company-select" class="select_gallery" style="width: 500px;" disabled>
|
||||
<option value="0">所有公司</option>
|
||||
<?php foreach($companies as $company):?>
|
||||
<option value="<?=$company['id']?>" <?php if($record['company_id']==$company['id']):?>select<?php endif;?>><?=$company['company_name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>游戏类型:</td>
|
||||
<td class="r">
|
||||
<select name="game_type_id" id="game-type-select" class="select_gallery" disabled>
|
||||
<option value="0">所有游戏类型</option>
|
||||
<?php foreach($gameTypes as $gameType):?>
|
||||
<option value="<?=$gameType['id']?>" <?php if($record['game_type_id']==$gameType['id']):?>select<?php endif;?>><?=$gameType['type_name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>游戏:</td>
|
||||
<td class="r">
|
||||
<select name="game_id" id="game-select" class="select_gallery" style="width: 500px;" disabled>
|
||||
<option value="0">所有择游戏</option>
|
||||
<?php foreach($games as $game):?>
|
||||
<option value="<?=$game['id']?>" <?php if($record['game_id']==$game['id']):?>select<?php endif;?>><?=$game['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>支付宝支付配置:</td>
|
||||
<td class="r">
|
||||
<select name="alipay_merchant_id" id="alipay-merchant-select" class="select_gallery">
|
||||
<option value="0">跟随系统默认商户</option>
|
||||
<?php foreach($aliMerchants as $merchant):?>
|
||||
<option value="<?=$merchant['id']?>"><?=$merchant['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>微信支付配置:</td>
|
||||
<td class="r">
|
||||
<select name="weixin_merchant_id" id="weixin-merchant-select" class="select_gallery">
|
||||
<option value="0">跟随系统默认商户</option>
|
||||
<?php foreach($weixinMerchants as $merchant):?>
|
||||
<option value="<?=$merchant['id']?>"><?=$merchant['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><i class="mustmark">*</i>快捷支付配置:</td>
|
||||
<td class="r">
|
||||
<select name="express_merchant_id" id="express-merchant-select" class="select_gallery">
|
||||
<option value="0">跟随系统默认商户</option>
|
||||
<?php foreach($expressMerchants as $merchant):?>
|
||||
<option value="<?=$merchant['id']?>"><?=$merchant['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l">生效时间(开始):</td>
|
||||
<td class="r">
|
||||
<input type="text" id="start_time" name="start_time" class="time" value="" autocomplete="off" placeholder="请选择生效时间(开始)" style="width: 200px"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l">生效时间(结束):</td>
|
||||
<td class="r">
|
||||
<input type="text" id="end_time" name="end_time" class="time" value="" autocomplete="off" placeholder="请选择生效时间(开始)" style="width: 200px"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="form-item cf">
|
||||
<button class="submit_btn mlspacing" id="submit" type="submit" target-form="form-horizontal">
|
||||
确认
|
||||
</button>
|
||||
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();" >
|
||||
返回
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
<div style="margin-top: 30px; height: 35px; width: 100%;">
|
||||
<a class="submit_btn" href="javascript:;" id="submit" style="margin: 0px auto; margin-left: 208px; ">全部提交</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="common_settings">
|
||||
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
|
||||
<form class="addShortcutIcon">
|
||||
<input type="hidden" name="title" value="{$m_title}">
|
||||
<input type="hidden" name="url" value="Promote/lists/type/1">
|
||||
</form>
|
||||
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
|
||||
</div>
|
||||
|
||||
</block>
|
||||
|
||||
<block name="script">
|
||||
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
|
||||
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
|
||||
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
|
||||
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
|
||||
<script type="text/javascript">
|
||||
//导航高亮
|
||||
highlight_subnav("{:U('Market/rebindRecords')}");
|
||||
$(".select_gallery").select2();
|
||||
|
||||
$(function(){
|
||||
$('.time').datetimepicker({
|
||||
format: 'yyyy-mm-dd',
|
||||
language: "zh-CN",
|
||||
autoclose: true,
|
||||
scrollMonth: false,
|
||||
scrollTime: false,
|
||||
scrollInput: false,
|
||||
startView: 'month',
|
||||
minView:'month',
|
||||
maxView:'month',
|
||||
});
|
||||
showTab();
|
||||
$('#company-belong-select').on({
|
||||
change: function() {
|
||||
var companyBelong = $(this).val()
|
||||
getCompaniesByBelong(companyBelong, function(companies) {
|
||||
var html = '<option value="">所有推广公司</option>'
|
||||
for (var key in companies) {
|
||||
html += '<option value="' +
|
||||
companies[key].id +
|
||||
'">' + companies[key].company_name + '</option>'
|
||||
}
|
||||
$('#company-select').html(html)
|
||||
$('#company-select').select2()
|
||||
})
|
||||
}
|
||||
})
|
||||
$('#game-type-select').on({
|
||||
change: function() {
|
||||
var gameTypeId = $(this).val()
|
||||
getGamesByType(gameTypeId, function(games) {
|
||||
var html = '<option value="">所有游戏</option>'
|
||||
for (var key in games) {
|
||||
html += '<option value="' +
|
||||
games[key].id +
|
||||
'">' + games[key].name + '</option>'
|
||||
}
|
||||
$('#game-select').html(html)
|
||||
$('#game-select').select2()
|
||||
})
|
||||
}
|
||||
})
|
||||
function getCompaniesByBelong(companyBelong, callback) {
|
||||
$.ajax({
|
||||
url: '{:U("getCompaniesByBelong")}',
|
||||
type: 'get',
|
||||
dataType: 'json',
|
||||
data: {company_belong: companyBelong},
|
||||
success: function(result) {
|
||||
if (result.status == 1) {
|
||||
callback(result.data.companies)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
function getGamesByType(gameTypeId, callback) {
|
||||
$.ajax({
|
||||
url: '{:U("getGamesByType")}',
|
||||
type: 'get',
|
||||
dataType: 'json',
|
||||
data: {game_type_id: gameTypeId},
|
||||
success: function(result) {
|
||||
if (result.status == 1) {
|
||||
callback(result.data.games)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$('#submit').click(function (e) {
|
||||
var target = $('form').get(0).action;
|
||||
var query = $('form').serialize();
|
||||
var that = this;
|
||||
$(that).addClass('disabled').attr('autocomplete','off').prop('disabled',true);
|
||||
$.post(target,query).success(function(result){
|
||||
if(layer) { layer.closeAll('loading'); }
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message)
|
||||
setTimeout(function() {
|
||||
window.location.href = '{:U("rules")}'
|
||||
}, 200)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</block>
|
@ -0,0 +1,332 @@
|
||||
<extend name="Public/base"/>
|
||||
<block name="css">
|
||||
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="__CSS__/promote.css" type="text/css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
|
||||
<style>
|
||||
.select2-container--default .select2-selection--single {
|
||||
color: #000;
|
||||
resize: none;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
|
||||
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
|
||||
height:28px;border-radius:3px;font-size:12px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
line-height:35px;
|
||||
line-height:28px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height:26px;
|
||||
}
|
||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||
height:26px;line-height:26px;font-size:12px;
|
||||
}
|
||||
.select2-results__option[aria-selected] {font-size:12px;}
|
||||
.textarea-style {
|
||||
width: 200px;
|
||||
height: 80px;
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
.mustmark {
|
||||
color: #FF0000;
|
||||
font-style: normal;
|
||||
margin: 0 3px;
|
||||
}
|
||||
</style>
|
||||
</block>
|
||||
<block name="body">
|
||||
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/select2.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/jquery.form.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
|
||||
|
||||
<script src="__STATIC__/md5.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="__STATIC__/webuploader/webuploader.js"></script>
|
||||
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
|
||||
<div class="cf main-place top_nav_list navtab_list">
|
||||
<h3 class="page_title">支付商户配置</h3>
|
||||
</div>
|
||||
<div class="cf top_nav_list">
|
||||
<!-- 高级搜索 -->
|
||||
<div class="jssearch fl cf search_list">
|
||||
<div class="input-list search-title-box">
|
||||
<label>搜索:</label>
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<select id="company_belong_select" name="company_belong" class="select_gallery" style="width:200px;">
|
||||
<option value="">请选择公司类型</option>
|
||||
<?php foreach($companyTypes as $key => $name):?>
|
||||
<option value="<?=$key?>"><?=$name?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select id="status_select" name="status" class="select_gallery" style="width:200px;">
|
||||
<option value="">请选择公司</option>
|
||||
<?php foreach($companies as $company):?>
|
||||
<option value="<?=$company['id']?>"><?=$company['company_name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select id="status_select" name="status" class="select_gallery" style="width:200px;">
|
||||
<option value="">请选择游戏类型</option>
|
||||
<?php foreach($gameTypes as $gameType):?>
|
||||
<option value="<?=$gameType['id']?>"><?=$gameType['type_name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select id="status_select" name="status" class="select_gallery" style="width:200px;">
|
||||
<option value="">请选择游戏</option>
|
||||
<?php foreach($games as $game):?>
|
||||
<option value="<?=$game['id']?>"><?=$game['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<input type="text" id="started_at" name="started_at" class="time" value="" placeholder="生效开始时间" autocomplete="off" />
|
||||
-
|
||||
<div class="input-append date" id="datetimepicker" style="display:inline-block">
|
||||
<input type="text" id="ended_at" name="ended_at" class="time" value="" placeholder="生效结束时间" autocomplete="off" />
|
||||
<span class="add-on"><i class="icon-th"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select name="alipay_merchant_id" id="alipay-merchant-select" class="select_gallery" style="width:200px;">
|
||||
<option value="0">支付宝配置商户</option>
|
||||
<?php foreach($aliMerchants as $merchant):?>
|
||||
<option value="<?=$merchant['id']?>"><?=$merchant['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select name="weixin_merchant_id" id="weixin-merchant-select" class="select_gallery" style="width:200px;">
|
||||
<option value="0">支付宝配置商户</option>
|
||||
<?php foreach($weixinMerchants as $merchant):?>
|
||||
<option value="<?=$merchant['id']?>"><?=$merchant['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select name="express_merchant_id" id="express-merchant-select" class="select_gallery" style="width:200px;">
|
||||
<option value="0">支付宝配置商户</option>
|
||||
<?php foreach($expressMerchants as $merchant):?>
|
||||
<option value="<?=$merchant['id']?>"><?=$merchant['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<a class="sch-btn" href="javascript:;" id="search" url="{:U('Market/rebindRecords')}">搜索</a>
|
||||
<a class="sch-btn" style="width: 100px;" href="{:U('PaymentMerchant/addRule')}">新增配置</a>
|
||||
<!-- <a class="sch-btn" href="javascript:;" id="batch-delete-btn">删除</a> -->
|
||||
</div>
|
||||
<!-- <div class="input-list">
|
||||
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>12,),I('get.')))}">导出</a>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 数据列表 -->
|
||||
<div class="data_list">
|
||||
<div class="">
|
||||
<table>
|
||||
<!-- 表头 -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th>公司类型</th>
|
||||
<th>推广公司</th>
|
||||
<th>游戏类型</th>
|
||||
<th>游戏产品</th>
|
||||
<th>支付宝支付配置</th>
|
||||
<th>商户账号</th>
|
||||
<th>微信支付配置</th>
|
||||
<th>商户账号</th>
|
||||
<th>快捷支付配置</th>
|
||||
<th>商户账号</th>
|
||||
<th>生效时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<!-- 列表 -->
|
||||
<tbody>
|
||||
<empty name ="records">
|
||||
<td colspan="12" class="text-center">aOh! 暂时还没有内容!</td>
|
||||
<else />
|
||||
<volist name="records" id="data">
|
||||
<tr data-id="<?=$data['id']?>">
|
||||
<td>{$data.company_type_name}</td>
|
||||
<td>{$data.company_name}</td>
|
||||
<td>{$data.game_type_name}</td>
|
||||
<td>{$data.game_name}</td>
|
||||
<td>{$data.alipay_merchant_name}</td>
|
||||
<td>{$data.alipay_merchant_account}</td>
|
||||
<td>{$data.weixin_merchant_name}</td>
|
||||
<td>{$data.weixin_merchant_account}</td>
|
||||
<td>{$data.express_merchant_name}</td>
|
||||
<td>{$data.express_merchant_account}</td>
|
||||
<td>{$data.effective_time_display}</td>
|
||||
<td>
|
||||
<div class="partakebtn">
|
||||
<a href="<?=U('edit', ['id' => $data['id']])?>">编辑</a>
|
||||
<a class="delete-btn">删除</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</volist>
|
||||
</empty>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page">
|
||||
<if condition="$role_export_check eq true ">
|
||||
<!-- <a class="sch-btn export-btn"
|
||||
href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a> -->
|
||||
</if>
|
||||
{$_page|default=''}
|
||||
</div>
|
||||
|
||||
<div class="common_settings">
|
||||
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
|
||||
<form class="addShortcutIcon">
|
||||
<input type="hidden" name="title" value="{$m_title}">
|
||||
<input type="hidden" name="url" value="Query/withdraw">
|
||||
</form>
|
||||
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
|
||||
</div>
|
||||
</block>
|
||||
|
||||
<block name="script">
|
||||
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
|
||||
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
|
||||
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
|
||||
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
|
||||
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
|
||||
<script src="__STATIC__/jquery.cookie.js" charset="utf-8"></script>
|
||||
<script>
|
||||
<volist name=":I('get.')" id="vo">
|
||||
Think.setValue('{$key}',"{$vo}");
|
||||
</volist>
|
||||
$(".select_gallery").select2();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
//导航高亮
|
||||
highlight_subnav("{:U('Market/rebindRecords')}");
|
||||
$(function(){
|
||||
//搜索功能
|
||||
$("#search").click(function(){
|
||||
var url = $(this).attr('url');
|
||||
var query = $('.jssearch').find('input').serialize();
|
||||
query += "&"+$('.jssearch').find('select').serialize();
|
||||
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
|
||||
query = query.replace(/^&/g,'');
|
||||
if( url.indexOf('?')>0 ){
|
||||
url += '&' + query;
|
||||
}else{
|
||||
url += '?' + query;
|
||||
}
|
||||
window.location.href = url;
|
||||
});
|
||||
//回车自动提交
|
||||
$('.jssearch').find('input').keyup(function(event){
|
||||
if(event.keyCode===13){
|
||||
$("#search").click();
|
||||
}
|
||||
})
|
||||
$('.time').datetimepicker({
|
||||
format: 'yyyy-mm-dd',
|
||||
language: "zh-CN",
|
||||
autoclose: true,
|
||||
scrollMonth: false,
|
||||
scrollTime: false,
|
||||
scrollInput: false,
|
||||
startView: 'month',
|
||||
minView:'month',
|
||||
maxView:'month',
|
||||
});
|
||||
$('#batch-delete-btn').on({
|
||||
click: function() {
|
||||
var ids = getIds();
|
||||
$.ajax({
|
||||
url: '{:U("batchDelete")}',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {ids: ids},
|
||||
success: function(result) {
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message)
|
||||
setTimeout(function() {
|
||||
window.location.href = window.location.href
|
||||
}, 200)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
function getIds() {
|
||||
var ids = [];
|
||||
$('.ids:checked').each(function() {
|
||||
ids.push($(this).val());
|
||||
})
|
||||
return ids;
|
||||
}
|
||||
$('.delete-btn').on({
|
||||
click: function() {
|
||||
var id = $(this).parents('tr').eq(0).attr('data-id');
|
||||
$.ajax({
|
||||
url: '{:U("deleteRule")}',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {id: id},
|
||||
success: function(result) {
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message)
|
||||
setTimeout(function() {
|
||||
window.location.href = window.location.href
|
||||
}, 200)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
$('.cancel-btn').on({
|
||||
click: function() {
|
||||
var id = $(this).parents('tr').eq(0).attr('data-id');
|
||||
$.ajax({
|
||||
url: '{:U("cancel")}',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {id: id},
|
||||
success: function(result) {
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message)
|
||||
setTimeout(function() {
|
||||
window.location.href = window.location.href
|
||||
}, 200)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
/* $(".export-btn").on("click",function(e){
|
||||
e.preventDefault();
|
||||
window.location.href=$(this).attr("href")
|
||||
}) */
|
||||
</script>
|
||||
</block>
|
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
namespace Base\Service;
|
||||
|
||||
use Base\Facade\Request;
|
||||
|
||||
class PaymentMerchantService {
|
||||
|
||||
const WAY_ALIPAY = 1;
|
||||
const WAY_WEIXIN = 2;
|
||||
const WAY_EXPRESS = 4;
|
||||
|
||||
const STATUS_ACTIVE = 1;
|
||||
const STATUS_INACTIVE = 0;
|
||||
|
||||
public static $statusList = [
|
||||
0 => '禁用',
|
||||
1 => '启用',
|
||||
];
|
||||
|
||||
public static $channels = [
|
||||
1 => '支付宝',
|
||||
2 => '微信支付',
|
||||
3 => '易宝支付',
|
||||
4 => '双乾支付',
|
||||
5 => '汇付宝支付',
|
||||
];
|
||||
|
||||
public static $ways = [
|
||||
self::WAY_ALIPAY => '支付宝',
|
||||
self::WAY_WEIXIN => '微信',
|
||||
self::WAY_EXPRESS => '快捷支付',
|
||||
];
|
||||
|
||||
public function getStatusText($status)
|
||||
{
|
||||
return self::$statusList[$status] ?? '未知';
|
||||
}
|
||||
|
||||
public function getChannelText($channel)
|
||||
{
|
||||
return self::$channels[$channel] ?? '未知';
|
||||
}
|
||||
|
||||
public function getMerchantsByIds(array $ids, $fields = '*')
|
||||
{
|
||||
if (count($ids) == 0) {
|
||||
return [];
|
||||
}
|
||||
$rules = M('payment_merchant', 'tab_')->field($fields)->where(['in' => ['in', $ids]])->select();
|
||||
return index_by_column('id', $rules);
|
||||
}
|
||||
|
||||
public function getMerchantsByWay($way)
|
||||
{
|
||||
$conditions = [];
|
||||
$conditions['_string'] = 'ways&' . $way . '=' . $way;
|
||||
$conditions['status'] = self::STATUS_ACTIVE;
|
||||
return M('payment_merchant', 'tab_')->where($conditions)->select();
|
||||
}
|
||||
|
||||
public function getWaysValue($ways)
|
||||
{
|
||||
$waysValue = 0;
|
||||
foreach ($ways as $way) {
|
||||
$waysValue = $waysValue | $way;
|
||||
}
|
||||
return $waysValue;
|
||||
}
|
||||
|
||||
public function getWaysRow($waysValue)
|
||||
{
|
||||
$row = [];
|
||||
foreach (self::$ways as $key => $name) {
|
||||
if (($waysValue & $key) == $key) {
|
||||
$row[] = $key;
|
||||
}
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
|
||||
public function getWaysName($waysValue)
|
||||
{
|
||||
$nameList = [];
|
||||
$keys = $this->getWaysRow($waysValue);
|
||||
foreach ($keys as $key) {
|
||||
$nameList[] = self::$ways[$key] ?? '未知';
|
||||
}
|
||||
return $nameList;
|
||||
}
|
||||
|
||||
public function setDefault($way, $merchantId)
|
||||
{
|
||||
$merchantBefore = $this->getDefault($way);
|
||||
if ($merchantBefore && $merchantBefore['id'] == $merchantId) {
|
||||
return;
|
||||
}
|
||||
$merchantAfter = M('payment_merchant', 'tab_')->where(['id' => $merchantId])->find();
|
||||
if ($merchantAfter) {
|
||||
$afterData = ['is_default' => $merchantAfter['is_default'] | $way];
|
||||
M('payment_merchant', 'tab_')->where(['id' => $merchantId])->save($afterData);
|
||||
}
|
||||
if ($merchantBefore) {
|
||||
$beforeData = ['is_default' => $merchantBefore['is_default'] ^ $way];
|
||||
M('payment_merchant', 'tab_')->where(['id' => $merchantBefore['id']])->save($beforeData);
|
||||
}
|
||||
}
|
||||
|
||||
public function getDefault($way)
|
||||
{
|
||||
return M('payment_merchant', 'tab_')->where(['_string' => 'is_default&' . $way . '=' . $way])->find();
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
namespace Base\Service;
|
||||
|
||||
use Base\Facade\Request;
|
||||
|
||||
class PaymentRuleService {
|
||||
|
||||
public function getRulesByIds(array $ids = null, $fields = '*')
|
||||
{
|
||||
$map = [];
|
||||
if (is_null($ids)) {
|
||||
$map['_string'] = '1=1';
|
||||
} elseif (count($ids) == 0) {
|
||||
return [];
|
||||
} else {
|
||||
$map['id'] = ['in', $ids];
|
||||
}
|
||||
$rules = M('payment_rule', 'tab_')->field($fields)->where($map)->select();
|
||||
return index_by_column('id', $rules);
|
||||
}
|
||||
|
||||
public function getEffectiveTimeDisplay($rule)
|
||||
{
|
||||
$startTime = $rule['start_time'] == 0 ? null : date('Y-m-d', $rule['start_time']);
|
||||
$endTime = $rule['end_time'] == 0 ? null : date('Y-m-d', $rule['end_time']);
|
||||
if ($startTime == null && $endTime == null) {
|
||||
return '永久';
|
||||
}
|
||||
if ($startTime != null && $endTime != null) {
|
||||
return $startTime . ' 至 ' . $endTime;
|
||||
}
|
||||
if ($startTime == null && $endTime != null) {
|
||||
return '从前 至 ' . $endTime;
|
||||
}
|
||||
if ($startTime != null && $endTime == null) {
|
||||
return $startTime . ' 至 永久';
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
namespace Base\Service;
|
||||
|
||||
use Base\Facade\Request;
|
||||
|
||||
class PromoteCompanyService
|
||||
{
|
||||
const BELONG_INSIDE = 0;
|
||||
const BELONG_OUTSIDE = 1;
|
||||
const BELONG_OUTSIDE_SP = 2;
|
||||
const BELONG_NONE = 3;
|
||||
|
||||
public static $belongs = [
|
||||
0 => '内团',
|
||||
1 => '外团',
|
||||
2 => '外团-分发',
|
||||
3 => '无',
|
||||
];
|
||||
|
||||
public function getOutBelongs()
|
||||
{
|
||||
return [
|
||||
self::BELONG_OUTSIDE => self::$belongs[self::BELONG_OUTSIDE],
|
||||
self::BELONG_OUTSIDE_SP => self::$belongs[self::BELONG_OUTSIDE_SP],
|
||||
];
|
||||
}
|
||||
|
||||
public function getCompanies(array $ids = null, $fields = '*')
|
||||
{
|
||||
$map = [];
|
||||
if (is_null($ids)) {
|
||||
$map['_string'] = '1=1';
|
||||
} elseif (count($ids) == 0) {
|
||||
return [];
|
||||
} else {
|
||||
$map['id'] = ['in', $ids];
|
||||
}
|
||||
$rules = M('promote_company', 'tab_')->field($fields)->where($map)->select();
|
||||
return index_by_column('id', $rules);
|
||||
}
|
||||
|
||||
public function getCompaniesByBelong($belong = null, $fields = '*')
|
||||
{
|
||||
$map = [];
|
||||
if (is_null($belong)) {
|
||||
$map['_string'] = '1=1';
|
||||
} else {
|
||||
$map['company_belong'] = $belong;
|
||||
}
|
||||
$rules = M('promote_company', 'tab_')->field($fields)->where($map)->select();
|
||||
return index_by_column('id', $rules);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue