module.php
7.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?php
/**
* 微无限分销模块定义
*
* @author 微无限分销
* @url http://bbs.k123456.com
*/
defined('IN_IA') or exit('Access Denied');
class wwx_fxxtModule extends WeModule {
private $reply_table = 'wwx_fxxt_reply';
///1.参数设置
public function settingsDisplay($settings)
{
global $_GPC, $_W;
load()->func('tpl');
$theone = pdo_fetch('SELECT * FROM ' . tablename('wwx_fxxt_rules') . " WHERE uniacid = :uniacid", array(':uniacid' => $_W['uniacid']));
$id = $theone['id'];
if (checksubmit()) {
load()->func('file');
mkdirs('../addons/wwx_fxxt/cert');
$r = true;
if (!empty($_GPC['api_cert'])) {
$ret = file_put_contents('../addons/wwx_fxxt/cert/apiclient_cert.pem.' . $_W['uniacid'], trim($_GPC['api_cert']));
$r = $r && $ret;
}
if (!empty($_GPC['api_key'])) {
$ret = file_put_contents('../addons/wwx_fxxt/cert/apiclient_key.pem.' . $_W['uniacid'], trim($_GPC['api_key']));
$r = $r && $ret;
}
if (!empty($_GPC['api_ca'])) {
$ret = file_put_contents('../addons/wwx_fxxt/cert/rootca.pem.' . $_W['uniacid'], trim($_GPC['api_ca']));
$r = $r && $ret;
}
if (!$r) {
message('证书保存失败, 请保证 /addons/wwx_fxxt/cert/ 目录可写');
}
$input = array_elements(array('api_appid', 'api_secret', 'api_QrCode', 'api_QrKey', 'api_ip'), $_GPC);
$input['api_appid'] = trim($input['api_appid']);
$input['api_secret'] = trim($input['api_secret']);
$input['api_QrCode'] = trim($input['api_QrCode']);
$input['api_QrKey'] = trim($input['api_QrKey']);
$input['api_ip'] = trim($input['api_ip']);
$clickcredit = $_GPC['clickcredit'];
if (!is_numeric($clickcredit)) {
message('请输入合法数字!');
}
if(empty($_GPC['commtime']))
{
message('需要设置佣金申请周期');
}
if(empty($_GPC['rebacktime']))
{
message('需要设置退换货期限');
}
if(intval($_GPC['rebacktime'])>=intval($_GPC['commtime']))
{
message('退换货期限不能大于货到等于佣金申请周期');
}
$settings['shopname'] = $_GPC['shopname'];//商城首页标题
$settings['footer'] = $_GPC['footer'];//底部版权名称
$settings['footerurl'] = $_GPC['footerurl'];//底部版权链接
$settings['agentRegister'] = $_GPC['agentRegister'];//用户注册登录
$settings['Thecharts'] = $_POST['Thecharts'];//开启各项排行榜
$settings['Themessage'] = $_GPC['Themessage'];//开启排行榜聊天系统
$settings['ThechartsSum'] = $_GPC['ThechartsSum'];//排行榜数量
$settings['indexss'] = intval($_GPC['indexss']);//首页限时特卖
$settings['webjs'] = $_GPC['webjs'];//全局JS参数设置
$settings['commtime'] = $_GPC['commtime'];//佣金申请周期
$settings['zhifuCommission'] = $_GPC['zhifuCommission'];//佣金打款限额
$settings['globalPattern'] = $_GPC['globalPattern'];//分佣方式
$settings['globalCommissionLevel'] = $_GPC['globalCommissionLevel'];//分销等级
$settings['globalCommission'] = $_GPC['globalCommission'];//1级整站佣金
$settings['globalCommission2'] = $_GPC['globalCommission2'];//2级整站佣金
$settings['globalCommission3'] = $_GPC['globalCommission3'];//3级整站佣金
$settings['agentupgrade'] = $_GPC['agentupgrade'];//代理自动升级
$settings['dimensionalcode'] = $_GPC['dimensionalcode'];//二维码权限
$settings['fansupgrade'] = $_GPC['fansupgrade'];//会员自动升级
$settings['description'] = $_GPC['description'];//转发话术
$settings['ydyy'] = $_GPC['ydyy'];//未关注引导页面
$settings['huodaoCommission'] = $_GPC['huodaoCommission'];//货到付款保证金
$settings['autofinish'] = $_GPC['autofinish'];//订单自动确认收货天数
$settings['rebacktime'] = $_GPC['rebacktime'];//退换货期限天数
$settings['ordertime'] = $_GPC['ordertime'];//自动取消订单时间,单位分钟
$settings['api'] = $input;//微信现金打款设置
//自动取消订单时间,单位分钟
if (intval($_GPC['ordertime']) >= 30) {
$settings['ordertime'] = $_GPC['ordertime'];
} else {
$settings['ordertime'] = 0;
}
//排行榜数量
if (empty($_GPC['ThechartsSum']) || $_GPC['ThechartsSum'] > 500) {
$settings['ThechartsSum'] = 10;
}
//转发图片
if (!empty($_GPC['logo'])) {
$settings['logo'] = $_GPC['logo'];
}
$this->saveSettings($settings);//保存设置参数
$clickcredit = $_GPC['clickcredit'];
if(!is_numeric($clickcredit)){
message('点击或扫描积分请输入合法数字!');
}
if($_GPC['promotertimes']=='2')
{
if(!is_numeric($_GPC['promotercount'])){
message('达到单数请输入合法数字!');
}
}
if($_GPC['promotertimes']=='3')
{
if(!is_numeric($_GPC['promotermoney'])){
message('达到金额请输入合法数字!');
}
}
$insert = array(
'uniacid' => $_W['uniacid'],
'clickcredit' => $clickcredit,//点击或扫描积分
'rule' => htmlspecialchars_decode($_GPC['rule']),//帮助说明
'commtime' => 0,
'promotertimes' => $_GPC['promotertimes'],//成为代理条件
'promotermoney' => $_GPC['promotermoney'],//成为代理条件达到金额
'promotercount' => $_GPC['promotercount'],//成为代理条件达到单数
'promoterstate' => $_GPC['promoterstate'],//成为代理条件订单状态
'createtime' => TIMESTAMP
);
if(empty($id)) {
pdo_insert('wwx_fxxt_rules', $insert);
} else {
pdo_update('wwx_fxxt_rules', $insert,array('id' => $id));
}
message('更新成功', 'refresh');
}
if(empty($settings['footer']))
{
$settings['footer']=$_W['account']['name']; //底部版权名称
}
if (empty($settings['api']['api_ip'])) {
$settings['api']['api_ip'] = $_SERVER['SERVER_ADDR'];
}
include $this->template('setting');
}
public function fieldsFormDisplay($rid = 0)
{
global $_W;
load()->func('tpl');
$setting = $_W['account']['modules'][$this->_saveing_params['mid']]['config'];
if (!empty($rid)) {
$reply = pdo_fetch("SELECT * FROM ".tablename($this->reply_table)." WHERE uniacid = :uniacid AND rid = :rid ORDER BY `id` DESC", array(':uniacid' => $_W['uniacid'], ':rid' => $rid));
}
include $this->template('rule');
}
public function fieldsFormValidate($rid = 0) {
//规则编辑保存时,要进行的数据验证,返回空串表示验证无误,返回其他字符串将呈现为错误提示。这里 $rid 为对应的规则编号,新增时为 0
return '';
}
public function fieldsFormSubmit($rid) {
global $_GPC, $_W;
load()->func('tpl');
$id = intval($_GPC['reply_id']);
$data = array(
'uniacid' => $_W['uniacid'],
'rid' => $rid,
'title' => $_GPC['title'],
'avatar' => $_GPC['avatar'],
'description' => $_GPC['description'],
'dateline' => time()
);
if(empty($id)) {
pdo_insert($this->reply_table, $data);
}else {
pdo_update($this->reply_table, $data, array('id' => $id));
}
}
public function ruleDeleted($rid) {
//删除规则时调用,这里 $rid 为对应的规则编号
}
}