Article.php
11 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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<?php
/**
* tpshop
* ============================================================================
* * 版权所有 2015-2027 深圳搜豹网络科技有限公司,并保留所有权利。
* 网站地址: http://www.tp-shop.cn
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
* 不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
* $Author: IT宇宙人 2015-08-10 $
*/
namespace app\mobile\controller;
use think\Db;
use think\Page;
class Article extends MobileBase {
// public $lists;
public function index(){
$article_id = I('article_id/d',38);
$article = D('article')->where("article_id", $article_id)->find();
$this->assign('article',$article);
return $this->fetch('',getMobileStoId());
}
/**
* 文章内列表页
*/
// public function articleList(){
// $list = M('Article')->where('is_open',1)->select();
// $article_categroy=M('Article_cat')->order('sort_order asc')->select();
// $this->assign('list',$list);
// $this->assign('article_categroy',$article_categroy);
// //return $this->fetch('',getMobileStoId());
// //return $this->fetch('articleList1');
// return $this->fetch();
// }
public function articleList(){
// //$list = M('Article')->where('is_open',1)->select();
// $p = I('p');
// $count = M('Article')->where('is_open',1)->count();
// //$pager = new Page($count,2);
// if($p==0){
// $pagercount = 2;
// }else{
// $pagercount = $p*2+2;
// }
// $sql = "SELECT * FROM __PREFIX__article WHERE is_open = 1 ORDER BY article_id DESC LIMIT 0,".$pagercount;
// $list = DB::query($sql);
// // $lists = $lists.$list;
$article_categroy=M('Article_cat')->where(' show_in_nav=1 and store_id='.getMobileStoId())->order('sort_order asc')->select();
// //$show = $pager->show();
// $this->assign('page',$show);
// $this->assign('list',$list);
$this->assign('article_categroy',$article_categroy);
// //return $this->fetch('',getMobileStoId());
// //return $this->fetch('articleList1');
return $this->fetch();
}
public function articleList2()
{
//$list = M('Article')->where('is_open',1)->select();
$p = I('p');
$stoid = I('stoid');
$categroy = I('categroy');
if ($categroy == 0 || empty($categroy)) {
$count = M('Article')->where(array('is_open' => 1, 'store_id' => $stoid))->count();
}
else {
$count = M('Article')->where(array('is_open' => 1,'cat_id'=>$categroy, 'store_id' => $stoid))->count();
}
$pcount = 10;
$pager = new Page($count,$pcount);
$first = $p*$pcount;
if ($categroy==0 || empty($categroy) ) {
$sql = "SELECT article_id,cat_id,title,description,thumb,click,store_id FROM __PREFIX__article WHERE is_open = 1 and store_id = $stoid ORDER BY article_id DESC LIMIT ".$first.",".$pcount;
}else{
$sql = "SELECT article_id,cat_id,title,description,thumb,click,store_id FROM __PREFIX__article WHERE is_open = 1 and cat_id=$categroy and store_id = $stoid ORDER BY article_id DESC LIMIT ".$first.",".$pcount;
}
// mlog($sql);
$list = DB::query($sql);
$article_categroy=M('Article_cat')->where(' store_id='.getMobileStoId())->order('sort_order asc')->select();
if ($count>0)
{
$jsonlist['state']="1";
$jsonlist['msg']='成功';
$jsonlist['page']=$pager->totalPages;
}
else
{
$jsonlist['state']="0";
$jsonlist['msg']='无数据';
}
$jsonlist['item']=$list;
return json($jsonlist);
}
/**
* 文章内容页
*/
public function article(){
$article_id = I('article_id/d',1);
$article = D('article')->alias('a')->join("wxd_article_cat b","a.cat_id=b.cat_id")->field("a.*,b.cat_name")->where("article_id", $article_id)->find();
$this->assign('article',$article);
D('article')->where("article_id",$article_id)->setInc('click');
upload_ylp_log('文章内容详情');
return $this->fetch('',getMobileStoId());
}
/**
* 图文文章内容页
*/
public function articletw(){
$article_id = I('article_id/d',1);
$article = D('wx_menulistdet')->alias('a')->field("a.*")->where("id", $article_id)->find();
$this->assign('article',$article);
D('wx_menulistdet')->where("id",$article_id)->setInc('click');
upload_ylp_log('图文文章内容详情');
return $this->fetch('',getMobileStoId());
}
/*--充值预存款--*/
public function Yucun_add($vipid,$rs,$tk)
{
// $data=array(
// 'VIPId' => $vipid,//会员ID
// 'BillDate'=>date('Y-m-d H:m:s'),//单据日期
// 'AdvanceItemId'=>$rs["yucun_Advance_Id"],//预存款项目id
// 'AddSum'=>$rs["price"],//预存金额
// 'Remark'=>$rs["integral_remark"],//摘要
// 'FromBillId'=>$rs["order_sn"],//来源ID
// 'kind'=>'',//空:自定义充值 非空:促销充值ID
// );
$data=array(
'FromId' => "1000201705094649303510",//会员ID
'CashRepNo'=>"201705094209303510",//单据日期
'Sum'=>0.01,//预存款项目id
'Operator'=>'微信商城',//来源
'Integral'=>-50,//预存金额
'vipRemark'=>"50积分兑换0.01元微券(少军专用)",//摘要
'Remark'=>"50积分兑换0.01元微券(少军专用111)",//来源ID
'Id'=>"6BBBF1B0-7E86-43C7-B6EA-458071E0A27A",//空:自定义充值 非空:促销充值ID
);
// {"FromId":"1000201705094649303510","CashRepNo":"201705094209303510","Sum":0.01,"Integral":-50,"vipRemark":"50\u79ef\u5206\u5151\u63620.01\u5143\u5fae\u5238(\u65e0\u9650\u5236)","Remark":"50\u79ef\u5206\u5151\u63620.01\u5143\u5fae\u5238","Id":"6BBBF1B0-7E86-43C7-B6EA-458071E0A27A"}
$re1=getApiData("wxd.vip.intertocash",$tk['api_token'],array($data,));
/*---
$list = array("access_token"=>"wxd.vip.intertocash");
$array =array(
'token'=>$tk['api_token'],
'data'=>array(
$data,
),//$data,
'map'=>"",
'order'=>"",
);
$json=json_encode($array);
mlog("微券:".$json,"weiquan");
$url=GetSignUrl($list);
if(empty($url)){
return json(["code"=>"-1","msg"=>"生成签名错误"]);
}
$rs=http_post_json($url,$json);---*/
upload_ylp_log('充值预存款');
return $rs;
}
public function tempUser(){
echo microtime_format('Ymd H:i:s,x',microtime_float());exit;
// $vipid="841370ce-908e-462d-9979-537a3b40e19e";
// $rs = M('recharge')->where('order_sn', "vop201704281641455906")->find();
// $tk=M("store")->where("store_id","1")->field("api_token")->find();
// $this->yucun_add($vipid,$rs,$tk);exit;
//$user = session('user');
// $users = D("users")->where("user_id", "2627")->find();
//
// if(empty($users["erpvipid"])){
// return json(["code"=>"-1","msg"=>"会员信息错误"]);
// }
// $id = $users["erpvipid"];
// $id = "{".$id."}";
// $data=array(
// 'VIPId' => "841370ce-908e-462d-9979-537a3b40e19e",//会员ID
// 'BillDate'=>date('Y-m-d'),//单据日期
// 'AdvanceItemId'=>'3ec13990-ba52-44c4-8124-94f0bc5b7a0f',//预存款项目id
// 'AddSum'=>'100',//预存金额
// 'Remark'=>'摘要',//摘要
// 'FromBillId'=>'robred2016092215225209265428',//来源ID
// 'kind'=>'',//空:自定义充值 非空:促销充值ID
// );
// $where['VIPId']=array('=','EF7CBA26-0F6C-43A4-A231-8C16DC831376');
// //$where["VIPId"]=array('=','441d2837-a651-4518-a55e-19f6aad644e1');
// //$where["VIPId"]=array('=','441d2837-a651-4518-a55e-19f6aad644e1');
// //$where['MobileTel']=array('=','13599906619');
//// $where['VIPNo']=array('=','1052');
// /*--测试用常量--*/
// $store = I('stoid');
// $tk=M("store")->where("store_id","1")->field("api_token")->find();
//
// $list = array("access_token"=>"wxd.vip.addactlist");
// /*--post数据--*/
// $array =array(
// 'token'=>"beba071ae1ed9b303938838955edd09b",//"d916271336cd2f3dfcf275d2bba47715", //$tk['api_token'],
// 'data'=>"",//$data,
// 'map'=>"",
// 'order'=>"",
// );
//
// $json=json_encode($array);
// //dump($json);exit;
// $url=GetSignUrl($list);
//
// if(empty($url)){
// return json(["code"=>"-1","msg"=>"生成签名错误"]);
// }
// $rs=http_post_json($url,$json);
//// $offinfo=json_decode(urldecode($rs[0]),true);
//// $yucun_money=$offinfo["data"][0]["VIPSum"];//
//// echo $yucun_money;exit;
// echo $rs[0];exit;
// $aa=json_decode(urldecode($rs[0]),true);
// //echo $rs[0];exit;
// echo $rs["data"][0]["VIPSum"]; exit;
// //dump($aa["data"][0]["Sum"]);exit;
//
//
// if($rs){
// return json_decode(urldecode($rs[0]),true);
// //return json($rs[0]);
// }else{
// //return json(["code"=>"-1","msg"=>"获取接口数据错误"]);
// }
$data=array(
'FromId' => "1000201705094649303510",//会员ID
'CashRepNo'=>"201705094209303510",//单据日期
'Sum'=>"0.01",//预存款项目id
'Integral'=>"-50",//预存金额
'vipRemark'=>"50积分兑换0.01元微券(少军专用)",//摘要
'Remark'=>"50积分兑换0.01元微券(少军专用111)",//来源ID
'Id'=>"6BBBF1B0-7E86-43C7-B6EA-458071E0A27A",//空:自定义充值 非空:促销充值ID
);
// {"FromId":"1000201705094649303510","CashRepNo":"201705094209303510","Sum":0.01,"Integral":-50,"vipRemark":"50\u79ef\u5206\u5151\u63620.01\u5143\u5fae\u5238(\u65e0\u9650\u5236)","Remark":"50\u79ef\u5206\u5151\u63620.01\u5143\u5fae\u5238","Id":"6BBBF1B0-7E86-43C7-B6EA-458071E0A27A"}
/*----
$list = array("access_token"=>"wxd.vip.intertocash");
$array =array(
'token'=>"beba071ae1ed9b303938838955edd09b",
'data'=>array(
$data,
),//$data,
'map'=>"",
'order'=>"",
);
$json=json_encode($array);
mlog("微券:".$json,"weiquan");
$url=GetSignUrl($list);---*/
if(empty($url)){
return json(["code"=>"-1","msg"=>"生成签名错误"]);
}
$rs=http_post_json($url,$json);
return $rs;
}
}