From 5d23fe64695c3c6010592b2e886d166855bfb60c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BC=97=E4=BA=A7-=E7=8E=8B=E5=9D=A4?= Date: Mon, 17 Nov 2025 05:51:28 +0800 Subject: [PATCH] fromdao251117 --- fapp/ciyon_ap/App.vue | 10 +- .../components/ciy-aivoice/ciy-aivoice.vue | 63 +- .../ciyon_ap/components/ciy-auth/ciy-auth.vue | 14 +- .../components/ciy-capcode/ciy-capcode.vue | 2 +- .../components/ciy-checkbox/ciy-checkbox.vue | 6 + fapp/ciyon_ap/components/ciy-dbg/ciy-dbg.vue | 122 ++ .../components/ciy-dialog/ciy-dialog.vue | 2 +- .../ciy-inputnumber/ciy-inputnumber.vue | 8 +- .../components/ciy-markdown/ciy-markdown.vue | 2 +- .../components/ciy-radio/ciy-radio.vue | 6 + .../components/ciy-radiobox/ciy-radiobox.vue | 194 --- .../components/ciy-selmap/ciy-selmap.vue | 44 +- .../components/ciy-selpage/ciy-selpage.vue | 16 +- .../components/ciy-showimgs/ciy-showimgs.vue | 4 +- .../components/ciy-upload/ciy-upload.vue | 4 +- fapp/ciyon_ap/pages/demo/case/comlife.vue | 2 +- fapp/ciyon_ap/pages/demo/comform/selmap.vue | 2 +- fapp/ciyon_ap/pages/demo/comform/selpage.vue | 8 +- fapp/ciyon_ap/pages/demo/comform/upload.vue | 10 +- fapp/ciyon_ap/pages/demo/comview/auth.vue | 9 +- fapp/ciyon_ap/pages/demo/curd/demo_edit.vue | 80 +- fapp/ciyon_ap/pages/demo/curd/demo_list.vue | 36 +- fapp/ciyon_ap/pages/demo/curd/me.vue | 12 +- fapp/ciyon_ap/pages/demo/page/func.vue | 3 +- fapp/ciyon_ap/pages/demo/page/sysinfo.vue | 4 +- fapp/ciyon_ap/pages/demo/test.vue | 2 +- fapp/ciyon_ap/pages/main/index.vue | 2 +- fapp/ciyon_ap/pages/main/me_cash.vue | 137 -- fapp/ciyon_ap/pages/main/me_cash_bank.vue | 90 - fapp/ciyon_ap/pages/main/me_info.vue | 106 -- fapp/ciyon_ap/pages/main/me_invoice.vue | 94 - fapp/ciyon_ap/pages/main/me_passchange.vue | 68 - .../me_cash_charge.vue => me/cash_charge.vue} | 24 +- .../me_cash_ie.vue => me/cashie_lst.vue} | 28 +- .../me_cash_in.vue => me/cashin_lst.vue} | 16 +- fapp/ciyon_ap/pages/me/cashout_cash.vue | 196 +++ .../me_cash_out.vue => me/cashout_lst.vue} | 38 +- .../invoice_lst.vue} | 38 +- .../invoicetitle.vue} | 119 +- fapp/ciyon_ap/pages/me/invoicing.vue | 102 ++ .../pages/{main => me}/me_bank_info.vue | 0 .../me_pnt_buy.vue => me/pnt_buylst.vue} | 35 +- .../{main/me_pnt.vue => me/pnt_buynow.vue} | 16 +- .../me_pnt_record.vue => me/pnt_lst.vue} | 10 +- .../me_problechat.vue => me/problem_chat.vue} | 57 +- .../me_problem.vue => me/problem_pub.vue} | 121 +- fapp/ciyon_ap/pages/me/safe_ccub.vue | 96 ++ fapp/ciyon_ap/pages/me/safe_password.vue | 64 + .../{main/me_real.vue => me/safe_real.vue} | 162 +- .../me_qrcode.vue => me/share_qrcode.vue} | 4 +- .../{main/me_suggest.vue => me/suggest.vue} | 67 +- fapp/ciyon_ap/pages/me/user_bank.vue | 90 + fapp/ciyon_ap/pages/me/user_info.vue | 102 ++ .../me_shipaddr.vue => me/user_shipaddr.vue} | 22 +- fapp/ciyon_ap/pages/pub/camera.vue | 4 +- fapp/ciyon_ap/pages/{main => pub}/paper.vue | 4 +- fapp/ciyon_ap/pages/{main => pub}/part.vue | 36 +- .../ciyon_ap/pages/{main => pub}/psection.vue | 18 +- fapp/ciyon_ap/pages/pub/web.vue | 3 +- fapp/ciyon_ap/util/ciy.js | 226 +-- fapp/ciyon_ap/util/style.css | 8 +- fapp/ciyon_ap/util/websocket.js | 122 ++ fapp/ciyon_ap/vite.config.js | 1 + web/admin/ap/api.php | 6 +- web/admin/ap/art_post.html | 2 +- web/admin/ap/art_post.php | 6 +- web/admin/ap/art_section.php | 6 +- web/admin/ap/art_vent.html | 2 +- web/admin/ap/art_vent.php | 6 +- web/admin/ap/banner.php | 6 +- web/admin/ap/cash_ie.php | 6 +- web/admin/ap/cash_in.php | 6 +- .../{cash_out_1.html => cash_out_apply.html} | 15 +- .../ap/{cash_out_1.php => cash_out_apply.php} | 34 +- .../{usr_invoicing.html => cash_out_inv.html} | 88 +- .../ap/{cash_out_2.php => cash_out_inv.php} | 111 +- web/admin/ap/cash_out_transfer.html | 214 +++ web/admin/ap/cash_out_transfer.php | 306 ++++ .../{cash_out_2.html => invoicedetail.html} | 40 +- web/admin/ap/invoicedetail.php | 197 +++ ...sr_invoicetitle.html => invoicetitle.html} | 0 ...{usr_invoicetitle.php => invoicetitle.php} | 24 +- web/admin/ap/invoicing.html | 201 +++ .../ap/{usr_invoicing.php => invoicing.php} | 209 ++- web/admin/ap/logdb.php | 12 + web/admin/ap/luser.php | 12 + web/admin/ap/paper.html | 18 +- web/admin/ap/paper.php | 6 +- web/admin/ap/pnt_bundle.php | 6 +- web/admin/ap/pnt_buy.php | 6 +- web/admin/ap/pnt_record.php | 6 +- web/admin/ap/pnt_track.php | 6 +- web/admin/ap/transfer.php | 6 +- web/admin/ap/user.html | 54 +- web/admin/ap/user.php | 6 +- web/admin/ap/user_service.php | 6 +- web/admin/ap/usr_buy_bundle.php | 6 +- web/admin/ap/usr_buy_user.php | 6 +- web/admin/ap/usr_capcode.php | 6 +- web/admin/ap/usr_problem.html | 8 +- web/admin/ap/usr_problem.php | 6 +- web/admin/ap/usr_real_apply.html | 90 +- web/admin/ap/usr_real_apply.php | 138 +- web/admin/ap/usr_sendmail.html | 100 ++ web/admin/ap/usr_sendmail.php | 206 +++ web/admin/ap/usr_sendsms.html | 100 ++ web/admin/ap/usr_sendsms.php | 203 +++ web/admin/ap/usr_shipaddr.php | 6 +- web/admin/ap/usr_suggest.html | 16 +- web/admin/ap/usr_suggest.php | 6 +- web/admin/autotask/task.php | 13 +- web/admin/common.php | 4 +- web/admin/demo/front/form_map.html | 18 +- web/admin/demo/front/win_alert.html | 2 +- web/admin/demo/multicat.html | 26 +- web/admin/demo/multicat.php | 51 +- web/admin/demo/normal.go | 10 +- web/admin/demo/normal.html | 193 +-- web/admin/demo/normal.php | 9 +- web/admin/develop/code_create.html | 39 +- web/admin/develop/code_create.php | 3 + web/admin/develop/code_list.html | 10 +- web/admin/develop/code_list.php | 16 +- web/admin/develop/code_pc_html.php | 89 +- web/admin/develop/code_pc_php.php | 116 +- web/admin/develop/code_saas.php | 4 +- web/admin/rigger/admin.go | 4 +- web/admin/rigger/admin.html | 8 +- web/admin/rigger/admin.php | 10 +- web/admin/rigger/autotask.php | 6 +- web/admin/rigger/autotskrun.go | 2 +- web/admin/rigger/autotskrun.php | 8 +- web/admin/rigger/cata.go | 8 +- web/admin/rigger/cata.html | 18 +- web/admin/rigger/cata.php | 55 +- web/admin/rigger/cataindex.php | 4 +- web/admin/rigger/config.php | 6 +- web/admin/rigger/crawtable.php | 6 +- web/admin/rigger/debug_user.php | 6 +- web/admin/rigger/depart.html | 2 +- web/admin/rigger/depart.php | 35 +- web/admin/rigger/funcslow.php | 6 +- web/admin/rigger/logdb.php | 6 +- web/admin/rigger/luser.php | 6 +- web/admin/rigger/menu.html | 19 +- web/admin/rigger/menu.php | 37 +- web/admin/rigger/mock.php | 6 +- web/admin/rigger/online.php | 6 +- web/admin/rigger/power.php | 6 +- web/admin/rigger/role.php | 6 +- web/admin/rigger/statsfunc.php | 6 +- web/ambap/common.php | 1 + web/ambap/demo/demo.php | 20 +- web/ambap/login.php | 48 +- web/ambap/{index.php => main.php} | 212 ++- web/ambap/me.php | 1507 +++++++++-------- web/ambap/wxpay.php | 25 +- web/jscss/ciy.js | 14 +- web/jscss/ciycmp.js | 4 +- web/jscss/ciycmp2.js | 25 +- web/jscss/ciytable.js | 209 +-- web/jscss/style.css | 18 +- web/z/index.php | 4 +- zciyphp/comm.php | 26 +- zciyphp/db.php | 18 +- zciyphp/pdo.php | 11 +- 166 files changed, 5356 insertions(+), 3188 deletions(-) create mode 100644 fapp/ciyon_ap/components/ciy-dbg/ciy-dbg.vue delete mode 100644 fapp/ciyon_ap/components/ciy-radiobox/ciy-radiobox.vue delete mode 100644 fapp/ciyon_ap/pages/main/me_cash.vue delete mode 100644 fapp/ciyon_ap/pages/main/me_cash_bank.vue delete mode 100644 fapp/ciyon_ap/pages/main/me_info.vue delete mode 100644 fapp/ciyon_ap/pages/main/me_invoice.vue delete mode 100644 fapp/ciyon_ap/pages/main/me_passchange.vue rename fapp/ciyon_ap/pages/{main/me_cash_charge.vue => me/cash_charge.vue} (78%) rename fapp/ciyon_ap/pages/{main/me_cash_ie.vue => me/cashie_lst.vue} (84%) rename fapp/ciyon_ap/pages/{main/me_cash_in.vue => me/cashin_lst.vue} (82%) create mode 100644 fapp/ciyon_ap/pages/me/cashout_cash.vue rename fapp/ciyon_ap/pages/{main/me_cash_out.vue => me/cashout_lst.vue} (62%) rename fapp/ciyon_ap/pages/{main/me_invoice_history.vue => me/invoice_lst.vue} (70%) rename fapp/ciyon_ap/pages/{main/me_invoicetitle.vue => me/invoicetitle.vue} (61%) create mode 100644 fapp/ciyon_ap/pages/me/invoicing.vue rename fapp/ciyon_ap/pages/{main => me}/me_bank_info.vue (100%) rename fapp/ciyon_ap/pages/{main/me_pnt_buy.vue => me/pnt_buylst.vue} (73%) rename fapp/ciyon_ap/pages/{main/me_pnt.vue => me/pnt_buynow.vue} (95%) rename fapp/ciyon_ap/pages/{main/me_pnt_record.vue => me/pnt_lst.vue} (93%) rename fapp/ciyon_ap/pages/{main/me_problechat.vue => me/problem_chat.vue} (75%) rename fapp/ciyon_ap/pages/{main/me_problem.vue => me/problem_pub.vue} (54%) create mode 100644 fapp/ciyon_ap/pages/me/safe_ccub.vue create mode 100644 fapp/ciyon_ap/pages/me/safe_password.vue rename fapp/ciyon_ap/pages/{main/me_real.vue => me/safe_real.vue} (57%) rename fapp/ciyon_ap/pages/{main/me_qrcode.vue => me/share_qrcode.vue} (88%) rename fapp/ciyon_ap/pages/{main/me_suggest.vue => me/suggest.vue} (56%) create mode 100644 fapp/ciyon_ap/pages/me/user_bank.vue create mode 100644 fapp/ciyon_ap/pages/me/user_info.vue rename fapp/ciyon_ap/pages/{main/me_shipaddr.vue => me/user_shipaddr.vue} (93%) rename fapp/ciyon_ap/pages/{main => pub}/paper.vue (92%) rename fapp/ciyon_ap/pages/{main => pub}/part.vue (73%) rename fapp/ciyon_ap/pages/{main => pub}/psection.vue (85%) create mode 100644 fapp/ciyon_ap/util/websocket.js rename web/admin/ap/{cash_out_1.html => cash_out_apply.html} (93%) rename web/admin/ap/{cash_out_1.php => cash_out_apply.php} (88%) rename web/admin/ap/{usr_invoicing.html => cash_out_inv.html} (55%) rename web/admin/ap/{cash_out_2.php => cash_out_inv.php} (64%) create mode 100644 web/admin/ap/cash_out_transfer.html create mode 100644 web/admin/ap/cash_out_transfer.php rename web/admin/ap/{cash_out_2.html => invoicedetail.html} (76%) create mode 100644 web/admin/ap/invoicedetail.php rename web/admin/ap/{usr_invoicetitle.html => invoicetitle.html} (100%) rename web/admin/ap/{usr_invoicetitle.php => invoicetitle.php} (91%) create mode 100644 web/admin/ap/invoicing.html rename web/admin/ap/{usr_invoicing.php => invoicing.php} (59%) create mode 100644 web/admin/ap/usr_sendmail.html create mode 100644 web/admin/ap/usr_sendmail.php create mode 100644 web/admin/ap/usr_sendsms.html create mode 100644 web/admin/ap/usr_sendsms.php rename web/ambap/{index.php => main.php} (66%) diff --git a/fapp/ciyon_ap/App.vue b/fapp/ciyon_ap/App.vue index 357dd14..338c809 100644 --- a/fapp/ciyon_ap/App.vue +++ b/fapp/ciyon_ap/App.vue @@ -66,7 +66,7 @@ app.globalData.storselect = '/'; app.globalData.storlist = { '/': 'https://ciyon.ciy.cn/ud/', - 'A': 'https://cf5.xinquanyou.cn/ud/' + 'A': 'https://cf5.nyyzsoft.cn/ud/' }; app.globalData.stortransfer = ['/']; @@ -82,7 +82,7 @@ setInterval(() => { if (app.globalData._restorage) { - app.callajax({ + app.callfunc({ func: 'login.restorage', data: {}, loadhide: true, @@ -107,7 +107,7 @@ } app.globalData._restorage = false; if (app.globalData.errdata.length > 0) { - app.callajax({ + app.callfunc({ func: 'login.uperr', data: { meid: app.getme().id, @@ -126,7 +126,7 @@ //lopn 结合me,将数据上传到平台 function getnewnotice() { return; - app.callajax({ + app.callfunc({ func: 'me.notice_new', showload: false, success: json => { @@ -141,6 +141,8 @@ //#ifdef MP-WEIXIN const accountInfo = uni.getAccountInfoSync(); + app.globalData._wxappid = accountInfo.miniProgram.appId; + app.globalData._wxenv = accountInfo.miniProgram.envVersion; app.globalData._version = accountInfo.miniProgram.version; if (!app.globalData._version) app.globalData._version = accountInfo.miniProgram.envVersion; diff --git a/fapp/ciyon_ap/components/ciy-aivoice/ciy-aivoice.vue b/fapp/ciyon_ap/components/ciy-aivoice/ciy-aivoice.vue index 813163d..b97333b 100644 --- a/fapp/ciyon_ap/components/ciy-aivoice/ciy-aivoice.vue +++ b/fapp/ciyon_ap/components/ciy-aivoice/ciy-aivoice.vue @@ -1,5 +1,5 @@ diff --git a/fapp/ciyon_ap/components/ciy-radio/ciy-radio.vue b/fapp/ciyon_ap/components/ciy-radio/ciy-radio.vue index cccf271..2552b9f 100644 --- a/fapp/ciyon_ap/components/ciy-radio/ciy-radio.vue +++ b/fapp/ciyon_ap/components/ciy-radio/ciy-radio.vue @@ -201,6 +201,11 @@ ._gp._left { flex-direction: row; + justify-content: flex-start; + } + + ._gp._left ._item { + flex-direction: row; } ._gp ._item { @@ -210,6 +215,7 @@ gap: 0.5em; min-width: 7em; padding: 0.5em; + flex-direction: row-reverse; } ._gp._itemright ._item { diff --git a/fapp/ciyon_ap/components/ciy-radiobox/ciy-radiobox.vue b/fapp/ciyon_ap/components/ciy-radiobox/ciy-radiobox.vue deleted file mode 100644 index b8cc0a9..0000000 --- a/fapp/ciyon_ap/components/ciy-radiobox/ciy-radiobox.vue +++ /dev/null @@ -1,194 +0,0 @@ - - - - - \ No newline at end of file diff --git a/fapp/ciyon_ap/components/ciy-selmap/ciy-selmap.vue b/fapp/ciyon_ap/components/ciy-selmap/ciy-selmap.vue index 8d538c9..cf0b54a 100644 --- a/fapp/ciyon_ap/components/ciy-selmap/ciy-selmap.vue +++ b/fapp/ciyon_ap/components/ciy-selmap/ciy-selmap.vue @@ -14,19 +14,19 @@ - + {{loc.name}}
{{loc.addr}}
- {{lang('selmap.select')}} + {{lang('selmap.select')}} {{lang('selmap.loced')}}
@@ -70,10 +110,9 @@ export default { data() { return { - name: '', - idno: '', + inputtype: 0, //1拍照识别,2语音识别手动录入扫描件,3nfc刷卡识别 nfcdata: {}, - nfcwork: 0 + nfcwork: 0, } }, onLoad() { @@ -81,58 +120,87 @@ }, methods: { async getinit() { - var retjson = await this.callajax({ - func: 'me.userreal_apply_get' + await this.getauth('info'); + var app = getApp(); + this.inputtype = 2; + var retjson = await this.callfunc({ + func: 'me.safe_real_init' }); this.init = retjson; if (retjson.code != 1) +<<<<<<< HEAD:fapp/ciyon_ap/pages/main/me_real.vue return; +======= + return this.alert(retjson.errmsg); +>>>>>>> publish:fapp/ciyon_ap/pages/me/safe_real.vue if (retjson.data && retjson.data.auditstatus == 100 && !this.me.truename) { this.me.truename = retjson.data.name; this.me.idid = retjson.data.idid; this.setstorage('me', this.me); +<<<<<<< HEAD:fapp/ciyon_ap/pages/main/me_real.vue var app = getApp(); var page = app.getpage(1); page.me = this.me; +======= + var page = app.getpage(1); + page.me = this.me; + } + this.editdata.name = this.me.truename; + this.editdata.idid = this.me.idid; + if (this.inputtype == 1) { + setTimeout(() => { + this.getrefsSync('cameraocr').Step(1); + }, 500); +>>>>>>> publish:fapp/ciyon_ap/pages/me/safe_real.vue } setTimeout(() => { this.getrefsSync('cameraocr').Step(1); }, 500); }, async submit(e) { +<<<<<<< HEAD:fapp/ciyon_ap/pages/main/me_real.vue // e.detail.value.name = '张东'; // e.detail.value.idno = '152304200111157127'; if (e.detail.value.name.length < 1) +======= + // this.editdata.name = '张东'; + // this.editdata.idid = '152304200111157127'; + if (this.editdata.name.length < 1) +>>>>>>> publish:fapp/ciyon_ap/pages/me/safe_real.vue return this.toast('请输入姓名'); - if (e.detail.value.idno.length < 10) + if (this.editdata.idid.length < 10) return this.toast('请输入身份证号'); if (this._loading) return; this._loading = true; - if (this.idimg) { + if (this.inputtype == 1 && this.idimg) { var opn = {}; opn.basepath = 'idcard'; opn.stor = '/'; - e.detail.value.idcard1 = await this.file_upload1(this.idimg, opn); + this.editdata.idcard1 = await this.file_upload1(this.idimg, opn); } - var retjson = await this.callajax({ - func: 'me.userreal_apply_submit', - data: e.detail.value + var retjson = await this.callfunc({ + func: 'me.safe_real_submit', + data: this.editdata }); this._loading = false; if (retjson.code != 1) return this.alert(retjson.errmsg); - await this.toast('申请已提交'); + await this.toast('申请提交成功'); uni.navigateBack(); }, +<<<<<<< HEAD:fapp/ciyon_ap/pages/main/me_real.vue async chgidcard(e) { +======= + async chgcameraocr(e) { +>>>>>>> publish:fapp/ciyon_ap/pages/me/safe_real.vue console.log(e); this.idimg = e.tempimg; if (this._loading) return this.toast('请稍后再试'); this._loading = true; - var retjson = await this.callajax({ - func: 'ai.aidecision', + var retjson = await this.callfunc({ + func: 'ciyai.aidecision', data: { id: 3, idcardocr: e.txts.join('\n') @@ -141,8 +209,25 @@ this._loading = false; if (retjson.code != 1) return this.alert(retjson.errmsg); - this.name = retjson.ai.name; - this.idno = retjson.ai.idno; + this.editdata.name = retjson.ai.name; + this.editdata.idno = retjson.ai.idno; + }, + async chgvoice(e) { + //按住说话,调用@change,界面上调用大模型给出合理结果,自动填写姓名和身份证号 + //简单的文字,用字符串匹配先试试。 + var retjson = await this.callfunc({ + func: 'ciyai.aidecision', + data: { + id: 4, + voicetxt: e.txt + } + }); + if (retjson.code != 1) + return this.alert(retjson.errmsg); + if (retjson.ai.name) + this.editdata.name = retjson.ai.name; + if (retjson.ai.idno) + this.editdata.idid = retjson.ai.idno; }, async readnfc() { var ciynfc = res => { @@ -162,8 +247,10 @@ console.log('connect', res); nfc.transceive({ data: buffer, - success(res) { + success: (res) => { console.log('transecive', res); + this.editdata.name = res.nfcdata.name; + this.editdata.idid = res.nfcdata.idno; }, fail(res) { console.log('transecive fail', res); @@ -202,23 +289,6 @@ //res.id = ArrayBuffer(8) {byteLength: 8, maxByteLength: 8, resizable: false, detached: false} //res.techs = ['NFC-B'] }, - async chgvoice(e) { - //按住说话,调用@change,界面上调用大模型给出合理结果,自动填写姓名和身份证号 - //简单的文字,用字符串匹配先试试。 - var retjson = await this.callajax({ - func: 'ai.aidecision', - data: { - id: 4, - voicetxt: e.txt - } - }); - if (retjson.code != 1) - return this.alert(retjson.errmsg); - if (retjson.ai.name) - this.name = retjson.ai.name; - if (retjson.ai.idno) - this.idno = retjson.ai.idno; - } } } \ No newline at end of file diff --git a/fapp/ciyon_ap/pages/main/me_qrcode.vue b/fapp/ciyon_ap/pages/me/share_qrcode.vue similarity index 88% rename from fapp/ciyon_ap/pages/main/me_qrcode.vue rename to fapp/ciyon_ap/pages/me/share_qrcode.vue index 73eaa51..2b6ed63 100644 --- a/fapp/ciyon_ap/pages/main/me_qrcode.vue +++ b/fapp/ciyon_ap/pages/me/share_qrcode.vue @@ -24,8 +24,8 @@ }, methods: { async getinit() { - var retjson = await this.callajax({ - func: 'me.getqrcode', + var retjson = await this.callfunc({ + func: 'me.share_qrcode_get', data: {} }); if (retjson.code != 1) diff --git a/fapp/ciyon_ap/pages/main/me_suggest.vue b/fapp/ciyon_ap/pages/me/suggest.vue similarity index 56% rename from fapp/ciyon_ap/pages/main/me_suggest.vue rename to fapp/ciyon_ap/pages/me/suggest.vue index 6d59669..9d4f5ba 100644 --- a/fapp/ciyon_ap/pages/main/me_suggest.vue +++ b/fapp/ciyon_ap/pages/me/suggest.vue @@ -6,33 +6,31 @@ -
- - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - + @@ -40,7 +38,7 @@ 未答复 {{todatetime(item.addtimes)}} @@ -54,15 +52,15 @@ \ No newline at end of file diff --git a/fapp/ciyon_ap/pages/me/user_info.vue b/fapp/ciyon_ap/pages/me/user_info.vue new file mode 100644 index 0000000..50770ff --- /dev/null +++ b/fapp/ciyon_ap/pages/me/user_info.vue @@ -0,0 +1,102 @@ + + + + + \ No newline at end of file diff --git a/fapp/ciyon_ap/pages/main/me_shipaddr.vue b/fapp/ciyon_ap/pages/me/user_shipaddr.vue similarity index 93% rename from fapp/ciyon_ap/pages/main/me_shipaddr.vue rename to fapp/ciyon_ap/pages/me/user_shipaddr.vue index e2124a8..065ef04 100644 --- a/fapp/ciyon_ap/pages/main/me_shipaddr.vue +++ b/fapp/ciyon_ap/pages/me/user_shipaddr.vue @@ -7,18 +7,18 @@ - + 收件人 {{item.name}} 联系电话 {{item.phone}} {{mcode(g.ciy_arearpc,item.areacode,'name').join(' . ')}} {{item.addr}} - + - + @@ -52,7 +52,7 @@ - +
定位
@@ -113,8 +113,8 @@ if (this._loading) return; this._loading = true; - var retjson = await this.callajax({ - func: 'me.shipaddr_get' + var retjson = await this.callfunc({ + func: 'me.user_shipaddr_list' }); this._loading = false; if (retjson.code != 1) @@ -171,8 +171,8 @@ if (this._loading) return; this._loading = true; - var retjson = await this.callajax({ - func: 'me.shipaddr_edit', + var retjson = await this.callfunc({ + func: 'me.user_shipaddr_edit', data: e.detail.value }); this._loading = false; @@ -188,15 +188,15 @@ async del(item) { if (await this.askmsg('是否删除?') != 'ok') return; - var retjson = await this.callajax({ - func: 'me.shipaddr_del', + var retjson = await this.callfunc({ + func: 'me.user_shipaddr_del', data: { id: item.data.id } }); if (retjson.code != 1) return this.alert(retjson.errmsg); - this.init.list[item.data._idx]._clas = 'del'; + this.init.list[item.data._idx]._del = true; setTimeout(() => { this.init.list.splice(item.data._idx, 1); }, 500); diff --git a/fapp/ciyon_ap/pages/pub/camera.vue b/fapp/ciyon_ap/pages/pub/camera.vue index 9510191..7905d23 100644 --- a/fapp/ciyon_ap/pages/pub/camera.vue +++ b/fapp/ciyon_ap/pages/pub/camera.vue @@ -30,7 +30,7 @@ onUnload() { var postparam = {}; postparam.id = this.opn.id; - var retjson = this.callajax({ + var retjson = this.callfunc({ func: 'pub.imgend', data: postparam }); @@ -47,7 +47,7 @@ postparam.id = this.opn.id; postparam.txts = e.txts.join('\n'); postparam.img = await this.file_upload1(e.tempimg, opn); - var retjson = await this.callajax({ + var retjson = await this.callfunc({ func: 'pub.imgadd', data: postparam }); diff --git a/fapp/ciyon_ap/pages/main/paper.vue b/fapp/ciyon_ap/pages/pub/paper.vue similarity index 92% rename from fapp/ciyon_ap/pages/main/paper.vue rename to fapp/ciyon_ap/pages/pub/paper.vue index 03c329d..c995495 100644 --- a/fapp/ciyon_ap/pages/main/paper.vue +++ b/fapp/ciyon_ap/pages/pub/paper.vue @@ -28,8 +28,8 @@ computed: {}, methods: { async getinit() { - var retjson = await this.callajax({ - func: 'index.paper', + var retjson = await this.callfunc({ + func: 'main.paper_get', data: this.opn }); if (retjson.code != 1) diff --git a/fapp/ciyon_ap/pages/main/part.vue b/fapp/ciyon_ap/pages/pub/part.vue similarity index 73% rename from fapp/ciyon_ap/pages/main/part.vue rename to fapp/ciyon_ap/pages/pub/part.vue index 099e7a5..5b22008 100644 --- a/fapp/ciyon_ap/pages/main/part.vue +++ b/fapp/ciyon_ap/pages/pub/part.vue @@ -17,13 +17,11 @@ -
- - - - - -
+ + + + +
@@ -35,8 +33,7 @@ diff --git a/web/admin/ap/cash_out_2.php b/web/admin/ap/cash_out_inv.php similarity index 64% rename from web/admin/ap/cash_out_2.php rename to web/admin/ap/cash_out_inv.php index 8507fe7..bc47714 100644 --- a/web/admin/ap/cash_out_2.php +++ b/web/admin/ap/cash_out_inv.php @@ -2,13 +2,15 @@ namespace web\admin\ap; -class cash_out_2 { +class cash_out_inv { static function setwhere($db, $post) { $query = $post->get('query'); $csql = new \ciy\sql('ap_cash_out'); $liid = objint($query, 'liid'); if ($liid > 0) $csql->where('cashstatus', $liid); + else + $csql->where('cashstatus=30'); $val = objstr($query, 'vuser'); if (!empty($val)) { $csqlt = new \ciy\sql('ap_user'); @@ -21,7 +23,7 @@ class cash_out_2 { $csql->where('vuser=0'); } } - $csql->where('cashtype', 1); + $csql->where('cashtype', objstr($query, 'cashtype')); $csql->wherenumrange('cashmoney', objstr($query, 'cashmoney_1'), objstr($query, 'cashmoney_2'), 100); $csql->wheredaterange('addtimes', objstr($query, 'addtimes')); $csql->where('cashno like', objstr($query, 'cashno')); @@ -43,7 +45,7 @@ class cash_out_2 { $rows = $db->get($csql, $mainrowcount); if ($rows === false) return errjson($db->error); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, 'ap_cash_out'); @@ -52,48 +54,74 @@ class cash_out_2 { $field[$fr]['c'] = ',' . $field[$fr]['c']; } $fshow = fieldadd($fshow, $field, 0, '_btn', '操作'); + $field['bankaccount']['c'] = ''; + $field['bankname']['c'] = ''; + $field['bankno']['c'] = ''; + $field['bankcode']['c'] = ''; + $field['cashno']['c'] = ''; $ret['field'] = $field; $ret['fshow'] = $fshow; } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"'); + $input[] = array('type' => 'select', 'form' => 'cashtype', 'name' => '提现方式', 'all' => '全部', 'select' => '独立纳税.个人微信'); $input[] = array('type' => 'num', 'form' => 'cashmoney', 'name' => '金额', 'prop' => ' style="width:4em;"'); $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '申请时间'); $input[] = array('type' => 'input', 'form' => 'cashno', 'name' => '支付编号', 'prop' => ' style="width:8em;"'); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser'); return succjson($ret); } - public static function json_update() { + public static function json_audit() { global $db; $rsuser = verifyfast(); //if (nopower($db, $rsuser['id'], 'p u')) // return errjson('您未被授权操作'); $post = new \ciy\post(); - $id = $post->getint('id'); - $cashno = $post->get('cashno'); + $act = $post->getint('act'); + $auditmsg = $post->get('auditmsg'); + $ids = $post->get('ids'); + if (empty($ids)) + return errjson('请选择至少一条'); + if ($act == 2) { + if (empty($auditmsg)) + return errjson('请填写拒绝原因'); + } $csql = new \ciy\sql('ap_cash_out'); - $csql->where('id', $id); - $datarow = $db->getone($csql); - if (!is_array($datarow)) - return errjson('数据不存在'); - if ($datarow['cashstatus'] != 20) - return errjson('提现状态不正确'); + $csql->where('id in', $ids); + $rows = $db->get($csql); + $ids = array(); try { $db->begin(); - $updata = array(); - $updata['cashstatus'] = 100; - $updata['cashtimes'] = tostamp(); - $updata['cashno'] = $cashno; - $csql = new \ciy\sql('ap_cash_out'); - $csql->where('id', $id); - if ($db->update($csql, $updata) === false) - throw new \Exception('更新失败:' . $db->error); - $updata['id'] = $id; - savelogdb($db, $rsuser['id'], 'ap_cash_out', $datarow, $updata); + foreach ($rows as $row) { + if ($row['cashstatus'] != 30) + continue; + if ($act == 2) { //退余额 + $updata = array(); + $updata['mycashmoney'] = array('mycashmoney+' . $row['cashmoney']); + $csql = new \ciy\sql('ap_user'); + $csql->where('id', $row['vuser']); + if ($db->update($csql, $updata) === false) + throw new \Exception('更新账户失败:' . $db->error); + } + $id = $row['id']; + $updata = array(); + if ($act == 1) { + $updata['cashstatus'] = 50; + } else { + $updata['cashstatus'] = 90; + $updata['auditmsg'] = $auditmsg; + } + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('id', $id); + if ($db->update($csql, $updata) === false) + throw new \Exception('更新失败:' . $db->error); + $updata['id'] = $id; + $ids[] = $id; + } $db->commit(); } catch (\Exception $ex) { $db->rollback(); @@ -101,9 +129,44 @@ class cash_out_2 { return errjson($ex->getMessage()); } $ret['data'] = $updata; + $ret['ids'] = $ids; return succjson($ret); } + public static function json_del() { + global $db; + $rsuser = verifyfast(); + //if (nopower($db, $rsuser['id'], 'p d')) + // return errjson('您未被授权操作'); + $post = new \ciy\post(); + $ids = $post->get('ids'); + if (empty($ids)) + return errjson('请选择至少一条'); + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('id in', $ids); + $rows = $db->get($csql); + $vids = array(); + try { + $db->begin(); + foreach ($rows as $row) { + if ($row['cashstatus'] < 90) + continue; + if ($row['addtimes'] > time() - 86400 * 30) + continue; + $delid = $row['id']; + delme($db, $delid, 'ap_cash_out'); + savelogdb($db, $rsuser['id'], 'ap_cash_out', $row, null); + $vids[] = $delid; + } + $db->commit(); + } catch (\Exception $ex) { + $db->rollback(); + savelogfile('err_db', $ex->getMessage()); + return errjson($ex->getMessage()); + } + $ret['ids'] = $vids; + return succjson($ret); + } public static function json_exportxls() { global $db; $rsuser = verifyfast(); diff --git a/web/admin/ap/cash_out_transfer.html b/web/admin/ap/cash_out_transfer.html new file mode 100644 index 0000000..b23c7e8 --- /dev/null +++ b/web/admin/ap/cash_out_transfer.html @@ -0,0 +1,214 @@ + + + + + + + + + + + + +
+ +
+
Loading...
+
+
+
+ 全选 + 反选 + | + 批量删除 +
+
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/web/admin/ap/cash_out_transfer.php b/web/admin/ap/cash_out_transfer.php new file mode 100644 index 0000000..121bfdd --- /dev/null +++ b/web/admin/ap/cash_out_transfer.php @@ -0,0 +1,306 @@ +get('query'); + $csql = new \ciy\sql('ap_cash_out'); + $liid = objint($query, 'liid'); + if ($liid > 0) + $csql->where('cashstatus', $liid); + else + $csql->where('cashstatus=50'); + $val = objstr($query, 'vuser'); + if (!empty($val)) { + $csqlt = new \ciy\sql('ap_user'); + $csqlt->where('name like', $val); + $trow = $db->getone($csqlt); + if (is_array($trow)) { + $csql->where('vuser', $trow['id']); + $query['vuser'] = $trow['name']; + } else { + $csql->where('vuser=0'); + } + } + $csql->where('cashtype', objstr($query, 'cashtype')); + $csql->wherenumrange('cashmoney', objstr($query, 'cashmoney_1'), objstr($query, 'cashmoney_2'), 100); + $csql->wheredaterange('addtimes', objstr($query, 'addtimes')); + $csql->where('cashno like', objstr($query, 'cashno')); + $order = objstr($query, 'order', 'id desc'); + $csql->order($order); + $query['order'] = $order; + return [$query, $csql]; + } + + public static function json_list() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + list($where, $csql) = self::setwhere($db, $post); + $pageno = $post->getint('pageno', 1); + $pagecount = $post->getint('pagecount', 10); + $csql->limit($pageno, $pagecount); + $mainrowcount = $post->getint('count'); + $rows = $db->get($csql, $mainrowcount); + if ($rows === false) + return errjson($db->error); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + if ($post->getbool('field')) { + $field = array(); + $fshow = $db->getfield($field, 'ap_cash_out'); + foreach ($field as $fr => $v) { + if (get('_' . $fr)) + $field[$fr]['c'] = ',' . $field[$fr]['c']; + } + $fshow = fieldadd($fshow, $field, 0, '_btn', '操作'); + $field['invfile']['c'] = ''; + $field['invcode']['c'] = ''; + $field['cashmoney']['c'] = '打款金额|,CNY'; + $field['taxmoney']['c'] = ''; + $ret['field'] = $field; + $ret['fshow'] = $fshow; + } + if ($post->getbool('once')) { + $ret['once'] = true; + $input = array(); + $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"'); + $input[] = array('type' => 'select', 'form' => 'cashtype', 'name' => '提现方式', 'all' => '全部', 'select' => '银行.微信'); + $input[] = array('type' => 'num', 'form' => 'cashmoney', 'name' => '金额', 'prop' => ' style="width:4em;"'); + $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '申请时间'); + $input[] = array('type' => 'input', 'form' => 'cashno', 'name' => '支付编号', 'prop' => ' style="width:8em;"'); + $ret['searchinput'] = $input; + } + $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser'); + return succjson($ret); + } + public static function json_audit() { + global $db; + $rsuser = verifyfast(); + //if (nopower($db, $rsuser['id'], 'p u')) + // return errjson('您未被授权操作'); + $post = new \ciy\post(); + $auditstatus = $post->getint('auditstatus'); + $auditmsg = $post->get('auditmsg'); + $cashno = $post->get('cashno'); + $id = $post->getint('id'); + if ($auditstatus == 90) { + if (empty($auditmsg)) + return errjson('请填写拒绝原因'); + } else { + if (empty($cashno)) + return errjson('请填写支付流水号'); + } + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('id', $id); + $row = $db->getone($csql); + if (!is_array($row)) + return errjson('数据不存在'); + if ($row['cashstatus'] != 50) + return errjson('数据状态不是待支付'); + $ids = array(); + try { + $db->begin(); + if ($auditstatus == 90) { //退余额 + $updata = array(); + $updata['mycashmoney'] = array('mycashmoney+' . $row['cashmoney']); + $csql = new \ciy\sql('ap_user'); + $csql->where('id', $row['vuser']); + if ($db->update($csql, $updata) === false) + throw new \Exception('更新账户失败:' . $db->error); + } + $id = $row['id']; + $updata = array(); + if ($auditstatus == 90) { + $updata['cashstatus'] = 90; + $updata['auditmsg'] = $auditmsg; + } else { + $updata['cashstatus'] = 100; + $updata['cashtimes'] = tostamp(); + $updata['cashno'] = $cashno; + } + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('id', $id); + if ($db->update($csql, $updata) === false) + throw new \Exception('更新失败:' . $db->error); + $updata['id'] = $id; + $ids[] = $id; + $db->commit(); + } catch (\Exception $ex) { + $db->rollback(); + savelogfile('err_db', $ex->getMessage()); + return errjson($ex->getMessage()); + } + $ret['data'] = $updata; + $ret['ids'] = $ids; + return succjson($ret); + } + + public static function json_del() { + global $db; + $rsuser = verifyfast(); + //if (nopower($db, $rsuser['id'], 'p d')) + // return errjson('您未被授权操作'); + $post = new \ciy\post(); + $ids = $post->get('ids'); + if (empty($ids)) + return errjson('请选择至少一条'); + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('id in', $ids); + $rows = $db->get($csql); + $vids = array(); + try { + $db->begin(); + foreach ($rows as $row) { + if ($row['cashstatus'] < 90) + continue; + if ($row['addtimes'] > time() - 86400 * 30) + continue; + $delid = $row['id']; + delme($db, $delid, 'ap_cash_out'); + savelogdb($db, $rsuser['id'], 'ap_cash_out', $row, null); + $vids[] = $delid; + } + $db->commit(); + } catch (\Exception $ex) { + $db->rollback(); + savelogfile('err_db', $ex->getMessage()); + return errjson($ex->getMessage()); + } + $ret['ids'] = $vids; + return succjson($ret); + } + public static function json_exportxls() { + global $db; + $rsuser = verifyfast(); + //if (nopower($db, $rsuser['id'], 'p e')) + // return errjson('您未被授权操作'); + $post = new \ciy\post(); + list($where, $csql) = self::setwhere($db, $post); + $rows = $db->get($csql); + if (count($rows) > 10000) + return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围'); + $fields = array(); + $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码'); + $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户'); + $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'cashmoney', 'name' => '打款金额'); + $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankaccount', 'name' => '账户名称'); + $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankno', 'name' => '银行卡号'); + $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankname', 'name' => '开户银行'); + $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankcode', 'name' => '联行号'); + $code_cashstatus = getcatas($db, 'cashstatus'); + $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name'); + $code_cashtype = $db->getdbcodes('ap_cash_out', 'cashtype'); + $datas = array(); + foreach ($rows as $row) { + $dat = array(); + foreach ($fields as $field) { + $field = $field['field']; + $val = isset($row[$field]) ? $row[$field] : ''; + if ($field == 'id') + $val = enid($val); + if ($field == 'cashstatus') + $val = ccode($code_cashstatus, $val); + if ($field == 'vuser') + $val = ccode($code_vuser, $val); + if ($field == 'cashtype') + $val = ($val == 1 ? $code_cashtype[0]['name'] : @$code_cashtype[1]['name']); + if ($field == 'cashmoney') { + $val = $row[$field]; + if ($row['taxmoney'] > 0) + $val -= $row['taxmoney']; + $val = number_format($val / 100, 2); + } + if ($field == 'addtimes') + $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val)); + if ($field == 'cashtimes') + $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val)); + $dat[] = $val; + } + $datas[] = $dat; + } + $param = array(); + $param['field'] = $fields; + $param['data'] = $datas; + $param['sheetname'] = '数据报表'; + $param['titleheight'] = '25'; //列头高度 + $param['landscape'] = true; //横向打印 + $param['fixtopage'] = true; //打印整个工作表 + $param['toptitle'] = 'Demo数据报表'; + $str = \ciy\excel::general_excel_xml($param); + $filename = ''; + if (empty($filename)) + $filename = date('Y-m-d_H-i-s') . rand(1000, 9999); + $filename .= '.xls'; + file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str); + return succjson(array('url' => '/ud/tmp/' . $filename)); + } + public static function json_exporttaxxls() { + global $db; + $rsuser = verifyfast(); + //if (nopower($db, $rsuser['id'], 'p e')) + // return errjson('您未被授权操作'); + $post = new \ciy\post(); + $month = $post->getint('month'); + $monthend = strtotime("+1 month", $month); + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('cashstatus', 100); + $csql->where('taxmoney>=0'); + $csql->where('cashtimes>=', $month); + $csql->where('cashtimes<', $monthend); + $csql->order('vuser,cashtimes'); + $rows = $db->get($csql); + //姓名与账户名称不符,且未银行卡的,风控提示 + + $fields = array(); + $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码'); + $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'name', 'name' => '姓名'); + $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'idid', 'name' => '身份证号'); + $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'cashmoney', 'name' => '涉税金额'); + $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'taxmoney', 'name' => '个税金额'); + $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankno', 'name' => '银行卡号'); + $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankname', 'name' => '开户银行'); + $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '申请时间'); + $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'cashtimes', 'name' => '支付时间'); + $code_vuser = getrelation($db, $rows, 'ap_usr_ext', 'vuser', 'id,truename,idid'); + $datas = array(); + foreach ($rows as $row) { + $dat = array(); + foreach ($fields as $field) { + $field = $field['field']; + $val = isset($row[$field]) ? $row[$field] : ''; + if ($field == 'id') + $val = enid($val); + if ($field == 'name') + $val = ccode($code_vuser, $row['vuser'], 'id', 'truename'); + if ($field == 'idid') + $val = ccode($code_vuser, $row['vuser'], 'id', 'idid'); + if ($field == 'cashmoney') + $val = number_format($val / 100, 2); + if ($field == 'taxmoney') + $val = number_format($val / 100, 2); + if ($field == 'addtimes') + $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val)); + if ($field == 'cashtimes') + $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val)); + $dat[] = $val; + } + $datas[] = $dat; + } + $param = array(); + $param['field'] = $fields; + $param['data'] = $datas; + $param['sheetname'] = '数据报表'; + $param['titleheight'] = '25'; //列头高度 + $param['landscape'] = true; //横向打印 + $param['fixtopage'] = true; //打印整个工作表 + $param['toptitle'] = '个税数据报表'; + $str = \ciy\excel::general_excel_xml($param); + $filename = ''; + if (empty($filename)) + $filename = date('Y-m-d_H-i-s') . rand(1000, 9999); + $filename .= '.xls'; + file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str); + return succjson(array('url' => '/ud/tmp/' . $filename)); + } +} diff --git a/web/admin/ap/cash_out_2.html b/web/admin/ap/invoicedetail.html similarity index 76% rename from web/admin/ap/cash_out_2.html rename to web/admin/ap/invoicedetail.html index 6be9f60..9d05279 100644 --- a/web/admin/ap/cash_out_2.html +++ b/web/admin/ap/invoicedetail.html @@ -17,6 +17,7 @@
+ 添加 导出
@@ -29,6 +30,7 @@ 全选 反选 | + 批量删除
@@ -37,17 +39,28 @@
- +
@@ -92,28 +92,28 @@ } , fn_tdcontent: function (key, datashow, field, data) { if (key == 'isuse') { - return ''; + return ''; } if (key == 'leaderuser') { - return ''; + return ''; } if (key == 'csort') { - return ''; + return ''; } if (key == '_btn') { - var html = '' + (data['id'] == 0 ? '新增' : '更新') + ''; - html += '调整'; + var html = '' + (data['id'] == 0 ? '新增' : '更新') + ''; + html += '调整'; return html; } if (key == 'name') { var deep = toint(data['_deep']); var html = ' '.repeat(deep); if (data['_count'] > 0) { - html += ' '; + html += ' '; } else { if (deep > 0) html += '  '; - html += ''; + html += ''; } return { divprop: (data['_count'] > 0 ? ' data-treeid="' + data['id'] + '"' : '') + ' data-deep="' + data['_deep'] + '" style="display: flex;" class="ciy-tree-spread"'// class="ciy-tree-spread" @@ -170,7 +170,7 @@ } function multiadd() { ciyfn.alert({ - title: '添加新部门' + title: '添加' , width: 'mb' , contentstyle: 'overflow:hidden;' , content: document.getElementById("alert_multiadd").innerHTML @@ -212,7 +212,7 @@ return menutxt; } ciyfn.alert({ - title: '部门结构' + title: '结构' , width: 'mb' , height: 'pc' , content: '' @@ -233,7 +233,7 @@ } if (btn == 'tz') { ciyfn.alert({ - title: '调整部门层级' + title: '调整层级' , content: document.getElementById("alert_modifyupid").innerHTML , fn_showed: function (doc, dom) { if (id == 0) diff --git a/web/admin/demo/multicat.php b/web/admin/demo/multicat.php index 432de49..c6da30f 100644 --- a/web/admin/demo/multicat.php +++ b/web/admin/demo/multicat.php @@ -24,7 +24,10 @@ class multicat { $ret['once'] = array(); $input = array(); $input[] = array( - 'type' => 'input', 'form' => 'name', 'name' => '组织名称', 'prop' => ' style="width:8em;"' + 'type' => 'input', + 'form' => 'name', + 'name' => '名称', + 'prop' => ' style="width:8em;"' ); $ret['once']['input'] = $input; } @@ -34,15 +37,15 @@ class multicat { public static function json_update() { global $db; $rsuser = verifyfast(); - - if (nopower($db, $rsuser['id'], 'p501u')) - return errjson('您未被授权操作'); + + // if (nopower($db, $rsuser['id'], 'p501u')) + // return errjson('您未被授权操作'); $post = new \ciy\post(); $updata = array(); $id = $post->getint('id'); $name = $post->get('name'); if ($name == '') - return errjson('请填写部门名称'); + return errjson('请填写名称'); $upid = $post->getint('upid'); $csort = $post->getint('csort'); $isuse = $post->getint('isuse'); @@ -78,9 +81,9 @@ class multicat { public static function json_del() { global $db; $rsuser = verifyfast(); - - if (nopower($db, $rsuser['id'], 'p501d')) - return errjson('您未被授权操作'); + + // if (nopower($db, $rsuser['id'], 'p501d')) + // return errjson('您未被授权操作'); $post = new \ciy\post(); $csql = new \ciy\sql('zc_depart'); $ids = $post->get('ids'); @@ -94,7 +97,7 @@ class multicat { foreach ($rows as $row) { $delid = $row['id']; delcheck($db, $delid, 'zc_admin', 'departid', '人员'); - delcheck($db, $delid, 'zc_depart', 'upid', '下级部门'); + delcheck($db, $delid, 'zc_depart', 'upid', '下级'); delme($db, $delid, 'zc_depart'); savelogdb($db, $rsuser['id'], 'zc_depart', $row, null); $vids[] = $delid; @@ -111,9 +114,9 @@ class multicat { public static function json_modifyupid() { global $db; $rsuser = verifyfast(); - - if (nopower($db, $rsuser['id'], 'p501u')) - return errjson('您未被授权操作'); + + // if (nopower($db, $rsuser['id'], 'p501u')) + // return errjson('您未被授权操作'); $post = new \ciy\post(); $id = $post->getint('id'); $newupid = $post->getint('newupid'); @@ -143,29 +146,45 @@ class multicat { public static function json_multiadd() { global $db; $rsuser = verifyfast(); - - if (nopower($db, $rsuser['id'], 'p501u')) - return errjson('您未被授权操作'); + + // if (nopower($db, $rsuser['id'], 'p501u')) + // return errjson('您未被授权操作'); $post = new \ciy\post(); $upid = $post->getint('upid'); $multi = explode("\n", $post->get('multi')); $cnt = 0; + $deepids = array(); + $deepids[0] = $upid; + $lastdeep = 0; try { $db->begin(); foreach ($multi as $m) { $m = trim($m); if (empty($m)) continue; + $deep = 0; + while (true) { + if (substr($m, 0, 2) != '--') + break; + $deep++; + $m = trim(substr($m, 2)); + } + if (empty($m)) + continue; + if ($lastdeep < $deep) + throw new \Exception('不能跳跃层级:' . $m); $updata = array(); $updata['name'] = $m; $updata['isuse'] = 1; - $updata['upid'] = $upid; + $updata['upid'] = $deepids[$deep]; $updata['csort'] = 10; $csql = new \ciy\sql('zc_depart'); if ($db->insert($csql, $updata) === false) throw new \Exception('新增失败:' . $db->error); $updata['id'] = $db->insert_id(); + $deepids[$deep + 1] = $updata['id']; + $lastdeep = $deep + 1; $cnt++; savelogdb($db, $rsuser['id'], 'zc_depart', null, $updata); } diff --git a/web/admin/demo/normal.go b/web/admin/demo/normal.go index 49cddc6..4ff175e 100644 --- a/web/admin/demo/normal.go +++ b/web/admin/demo/normal.go @@ -218,9 +218,8 @@ func Normal_update(w http.ResponseWriter, r *http.Request) bool { imgs := post.Get("imgs") ton := post.Getint("ton") price := post.Getint("price") - lat := post.Getfloat("lat") - lng := post.Getfloat("lng") - nums := post.Getfloat("nums") + lat := post.Getint("lat") + lng := post.Getint("lng") url := post.Get("url") idcard := post.Get("idcard") weightg := post.Getint("weightg") @@ -277,7 +276,6 @@ func Normal_update(w http.ResponseWriter, r *http.Request) bool { updata["price"] = price updata["lat"] = lat updata["lng"] = lng - updata["nums"] = nums updata["url"] = url updata["idcard"] = idcard updata["weightg"] = weightg @@ -441,7 +439,6 @@ func Normal_exportxls(w http.ResponseWriter, r *http.Request) bool { fields = append(fields, map[string]string{"style": "r", "width": "100", "field": "price", "name": "单价"}) fields = append(fields, map[string]string{"style": "l", "width": "100", "field": "lat", "name": "纬度"}) fields = append(fields, map[string]string{"style": "c", "width": "100", "field": "lng", "name": "位置"}) - fields = append(fields, map[string]string{"style": "r", "width": "100", "field": "nums", "name": "监管数量"}) fields = append(fields, map[string]string{"style": "l", "width": "100", "field": "url", "name": "链接"}) fields = append(fields, map[string]string{"style": "l", "width": "100", "field": "idcard", "name": "身份证号"}) fields = append(fields, map[string]string{"style": "r", "width": "100", "field": "weightg", "name": "体重"}) @@ -623,7 +620,6 @@ func Normal_importxls_in(w http.ResponseWriter, r *http.Request) bool { headsn = append(headsn, "单价.price") headsn = append(headsn, "纬度.lat") headsn = append(headsn, "位置.lng") - headsn = append(headsn, "监管数量.nums") headsn = append(headsn, "链接.url") headsn = append(headsn, "身份证号.idcard") headsn = append(headsn, "体重.weightg") @@ -1115,7 +1111,6 @@ func Normal_importxls_data(w http.ResponseWriter, r *http.Request) bool { price := post.Get("price_" + istr) lat := post.Get("lat_" + istr) lng := post.Get("lng_" + istr) - nums := post.Get("nums_" + istr) url := post.Get("url_" + istr) idcard := post.Get("idcard_" + istr) weightg := post.Get("weightg_" + istr) @@ -1153,7 +1148,6 @@ func Normal_importxls_data(w http.ResponseWriter, r *http.Request) bool { updata["price"] = price updata["lat"] = lat updata["lng"] = lng - updata["nums"] = nums updata["url"] = url updata["idcard"] = idcard updata["weightg"] = weightg diff --git a/web/admin/demo/normal.html b/web/admin/demo/normal.html index 289f415..84712fa 100644 --- a/web/admin/demo/normal.html +++ b/web/admin/demo/normal.html @@ -213,19 +213,13 @@
-
- -
- -
-
-
+
@@ -405,7 +399,6 @@ ciycmp({ dom: $5('[com=ton]', dom), value: dat.ton }); ciycmp({ dom: $5('[com=price]', dom), value: dat.price }); ciycmp({ dom: $5('[com=loc]', dom), value: { lat: dat.lat, lng: dat.lng } }); - $5('[name=nums]', dom).val(dat.nums); ciycmp({ dom: $5('[com=pct]', dom), value: dat.pct }); $5('[name=url]', dom).val(dat.url); ciycmp({ dom: $5('[com=weightg]', dom), value: dat.weightg }); @@ -452,222 +445,217 @@ var html = '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.auditstatus, table.field.auditstatus.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('auditstatus', dat.auditstatus, table.field.auditstatus.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.audituser, table.field.audituser.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('audituser', dat.audituser, table.field.audituser.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.audittimes, table.field.audittimes.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('audittimes', dat.audittimes, table.field.audittimes.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.auditmsg, table.field.auditmsg.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('auditmsg', dat.auditmsg, table.field.auditmsg.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.name, table.field.name.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('name', dat.name, table.field.name.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.menuid, table.field.menuid.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('menuid', dat.menuid, table.field.menuid.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.filesize, table.field.filesize.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('filesize', dat.filesize, table.field.filesize.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.metre, table.field.metre.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('metre', dat.metre, table.field.metre.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.bankmoney, table.field.bankmoney.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('bankmoney', dat.bankmoney, table.field.bankmoney.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.setdate, table.field.setdate.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('setdate', dat.setdate, table.field.setdate.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.settimes, table.field.settimes.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('settimes', dat.settimes, table.field.settimes.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.dayclock, table.field.dayclock.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('dayclock', dat.dayclock, table.field.dayclock.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.downurl, table.field.downurl.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('downurl', dat.downurl, table.field.downurl.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.avar, table.field.avar.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('avar', dat.avar, table.field.avar.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.isuse, table.field.isuse.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('isuse', dat.isuse, table.field.isuse.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.isopen, table.field.isopen.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('isopen', dat.isopen, table.field.isopen.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.unit, table.field.unit.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('unit', dat.unit, table.field.unit.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.sigstatus, table.field.sigstatus.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('sigstatus', dat.sigstatus, table.field.sigstatus.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.mauditstatus, table.field.mauditstatus.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('mauditstatus', dat.mauditstatus, table.field.mauditstatus.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.prodcata, table.field.prodcata.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('prodcata', dat.prodcata, table.field.prodcata.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.areacode, table.field.areacode.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('areacode', dat.areacode, table.field.areacode.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.renzheng, table.field.renzheng.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('renzheng', dat.renzheng, table.field.renzheng.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.ppint, table.field.ppint.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('ppint', dat.ppint, table.field.ppint.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.npcyc, table.field.npcyc.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('npcyc', dat.npcyc, table.field.npcyc.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.runsec, table.field.runsec.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('runsec', dat.runsec, table.field.runsec.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.acttm, table.field.acttm.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('acttm', dat.acttm, table.field.acttm.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.imgs, table.field.imgs.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('imgs', dat.imgs, table.field.imgs.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.ton, table.field.ton.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('ton', dat.ton, table.field.ton.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.price, table.field.price.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('price', dat.price, table.field.price.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.lng, table.field.lng.ext, dat, table.once, table.json, true); - html += '
'; - - html += '
'; - html += '
'; - html += ciyfn.tdshow(dat.nums, table.field.nums.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('lng', dat.lng, table.field.lng.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.pct, table.field.pct.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('pct', dat.pct, table.field.pct.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.url, table.field.url.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('url', dat.url, table.field.url.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.weightg, table.field.weightg.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('weightg', dat.weightg, table.field.weightg.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.eartmpr, table.field.eartmpr.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('eartmpr', dat.eartmpr, table.field.eartmpr.ext, dat, table.json, true); html += '
'; - html += '
'; + html += '
'; html += '
'; - html += ciyfn.tdshow(dat.qian, table.field.qian.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('qian', dat.qian, table.field.qian.ext, dat, table.json, true); html += '
'; - html += '
'; + html += '
'; html += '
'; - html += ciyfn.tdshow(dat.meishi, table.field.meishi.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('meishi', dat.meishi, table.field.meishi.ext, dat, table.json, true); html += '
'; - html += '
'; + html += '
'; html += '
'; - html += ciyfn.tdshow(dat.weight, table.field.weight.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('weight', dat.weight, table.field.weight.ext, dat, table.json, true); html += '
'; - html += '
'; + html += '
'; html += '
'; - html += ciyfn.tdshow(dat.height, table.field.height.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('height', dat.height, table.field.height.ext, dat, table.json, true); html += '
'; - html += '
'; + html += '
'; html += '
'; - html += ciyfn.tdshow(dat.skt, table.field.skt.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('skt', dat.skt, table.field.skt.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.idcard, table.field.idcard.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('idcard', dat.idcard, table.field.idcard.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.addtimes, table.field.addtimes.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('addtimes', dat.addtimes, table.field.addtimes.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.content, table.field.content.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('content', dat.content, table.field.content.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.md, table.field.md.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('md', dat.md, table.field.md.ext, dat, table.json, true); html += '
'; html += '
'; @@ -685,202 +673,197 @@ var html = '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.name, table.field.name.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('name', dat.name, table.field.name.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.menuid, table.field.menuid.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('menuid', dat.menuid, table.field.menuid.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.filesize, table.field.filesize.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('filesize', dat.filesize, table.field.filesize.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.metre, table.field.metre.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('metre', dat.metre, table.field.metre.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.bankmoney, table.field.bankmoney.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('bankmoney', dat.bankmoney, table.field.bankmoney.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.setdate, table.field.setdate.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('setdate', dat.setdate, table.field.setdate.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.settimes, table.field.settimes.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('settimes', dat.settimes, table.field.settimes.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.dayclock, table.field.dayclock.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('dayclock', dat.dayclock, table.field.dayclock.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.downurl, table.field.downurl.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('downurl', dat.downurl, table.field.downurl.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.avar, table.field.avar.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('avar', dat.avar, table.field.avar.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.isuse, table.field.isuse.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('isuse', dat.isuse, table.field.isuse.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.isopen, table.field.isopen.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('isopen', dat.isopen, table.field.isopen.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.unit, table.field.unit.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('unit', dat.unit, table.field.unit.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.sigstatus, table.field.sigstatus.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('sigstatus', dat.sigstatus, table.field.sigstatus.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.mauditstatus, table.field.mauditstatus.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('mauditstatus', dat.mauditstatus, table.field.mauditstatus.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.prodcata, table.field.prodcata.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('prodcata', dat.prodcata, table.field.prodcata.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.areacode, table.field.areacode.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('areacode', dat.areacode, table.field.areacode.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.renzheng, table.field.renzheng.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('renzheng', dat.renzheng, table.field.renzheng.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.ppint, table.field.ppint.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('ppint', dat.ppint, table.field.ppint.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.npcyc, table.field.npcyc.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('npcyc', dat.npcyc, table.field.npcyc.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.runsec, table.field.runsec.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('runsec', dat.runsec, table.field.runsec.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.acttm, table.field.acttm.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('acttm', dat.acttm, table.field.acttm.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.imgs, table.field.imgs.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('imgs', dat.imgs, table.field.imgs.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.ton, table.field.ton.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('ton', dat.ton, table.field.ton.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.price, table.field.price.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('price', dat.price, table.field.price.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.lng, table.field.lng.ext, dat, table.once, table.json, true); - html += '
'; - - html += '
'; - html += '
'; - html += ciyfn.tdshow(dat.nums, table.field.nums.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('lng', dat.lng, table.field.lng.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.pct, table.field.pct.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('pct', dat.pct, table.field.pct.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.url, table.field.url.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('url', dat.url, table.field.url.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.weightg, table.field.weightg.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('weightg', dat.weightg, table.field.weightg.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.eartmpr, table.field.eartmpr.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('eartmpr', dat.eartmpr, table.field.eartmpr.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.qian, table.field.qian.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('qian', dat.qian, table.field.qian.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.meishi, table.field.meishi.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('meishi', dat.meishi, table.field.meishi.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.weight, table.field.weight.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('weight', dat.weight, table.field.weight.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.height, table.field.height.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('height', dat.height, table.field.height.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.skt, table.field.skt.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('skt', dat.skt, table.field.skt.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.idcard, table.field.idcard.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('idcard', dat.idcard, table.field.idcard.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.addtimes, table.field.addtimes.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('addtimes', dat.addtimes, table.field.addtimes.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.content, table.field.content.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('content', dat.content, table.field.content.ext, dat, table.json, true); html += '
'; html += '
'; html += '
'; - html += ciyfn.tdshow(dat.md, table.field.md.ext, dat, table.once, table.json, true); + html += ciyfn.tdshow('md', dat.md, table.field.md.ext, dat, table.json, true); html += '
'; html += '
'; diff --git a/web/admin/demo/normal.php b/web/admin/demo/normal.php index ec87ca1..6b9c747 100644 --- a/web/admin/demo/normal.php +++ b/web/admin/demo/normal.php @@ -150,9 +150,8 @@ class normal { $imgs = $post->get('imgs'); $ton = $post->getint('ton'); $price = $post->getint('price'); - $lat = $post->getfloat('lat'); - $lng = $post->getfloat('lng'); - $nums = $post->getfloat('nums'); + $lat = $post->getint('lat'); + $lng = $post->getint('lng'); $pct = $post->getint('pct'); $url = $post->get('url'); $weightg = $post->getint('weightg'); @@ -205,7 +204,6 @@ class normal { $updata['price'] = $price; $updata['lat'] = $lat; $updata['lng'] = $lng; - $updata['nums'] = $nums; $updata['pct'] = $pct; $updata['url'] = $url; $updata['weightg'] = $weightg; @@ -370,7 +368,6 @@ class normal { $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'price', 'name' => '单价'); $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'lat', 'name' => '纬度'); $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'lng', 'name' => '位置'); - $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'nums', 'name' => '监管数量'); $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'pct', 'name' => '百分比'); $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'url', 'name' => '链接'); $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'weightg', 'name' => '体重'); @@ -527,7 +524,6 @@ class normal { $headsn[] = '吨位.ton'; $headsn[] = '单价.price'; $headsn[] = '位置.lng'; - $headsn[] = '监管数量.nums'; $headsn[] = '百分比.pct'; $headsn[] = '链接.url'; $headsn[] = '体重.weightg'; @@ -1052,7 +1048,6 @@ class normal { $updata['ton'] = $post->get('ton_' . $i); $updata['price'] = $post->get('price_' . $i); $updata['lng'] = $post->get('lng_' . $i); - $updata['nums'] = $post->get('nums_' . $i); $updata['pct'] = $post->get('pct_' . $i); $updata['url'] = $post->get('url_' . $i); $updata['weightg'] = $post->get('weightg_' . $i); diff --git a/web/admin/develop/code_create.html b/web/admin/develop/code_create.html index f62a9c7..c3654a2 100644 --- a/web/admin/develop/code_create.html +++ b/web/admin/develop/code_create.html @@ -91,6 +91,8 @@
+
+
@@ -125,14 +127,14 @@
- - + + | - + | - - - + + +
@@ -411,7 +413,7 @@ if (data.DATA_TYPE == 'text' || data.DATA_TYPE == 'mediumtext') { chkvalue = chkvalue.replace(',bmin', '').replace(',bout', ''); } - if (colcomment.cate == 'BR' || colcomment.cate == 'MD') { + if (colcomment.cate == 'BR' || colcomment.cate == 'MD' || colcomment.cate == 'FILEMD') { if (!colcomment.show) spset.nocmn = 'no'; } @@ -426,7 +428,6 @@ || data.COLUMN_NAME == 'ip') { spset.noup = 'no'; } - if (data.COLUMN_NAME == table.json.dbsaas.saasfield) { spset.noup = 'saas'; } @@ -451,7 +452,7 @@ if (colcomment.cate == 'DOWN' || colcomment.cate == 'AV' || colcomment.cate == 'IMG') { spset.num = toint(data.CHARACTER_MAXIMUM_LENGTH / 50); } - if (colcomment.cate == 'MD' || colcomment.cate == 'DOWN' || colcomment.cate == 'AV' || colcomment.cate == 'IMG' || colcomment.cate == 'IMG1') { + if (colcomment.cate == 'MD' || colcomment.cate == 'FILEMD' || colcomment.cate == 'DOWN' || colcomment.cate == 'AV' || colcomment.cate == 'IMG' || colcomment.cate == 'IMG1') { spset.savepath = data.COLUMN_NAME; if (spset.savepath.substring(spset.savepath.length - 4) == 'imgs') spset.savepath = spset.savepath.substring(0, spset.savepath.length - 4); @@ -461,6 +462,8 @@ spset.savepath = spset.savepath.substring(0, spset.savepath.length - 3); if (spset.savepath.substring(spset.savepath.length - 4) == 'file') spset.savepath = spset.savepath.substring(0, spset.savepath.length - 4); + if (spset.savepath.substring(spset.savepath.length - 3) == 'ver') + spset.savepath = spset.savepath.substring(0, spset.savepath.length - 3); } if (colcomment.dicttype == 'dictdb' && (colcomment.cate == 'DB' || colcomment.cate == 'CATU')) spset.listload = 'rel'; @@ -511,8 +514,8 @@ if (colcomment.cate == 'DOWN' || colcomment.cate == 'AV' || colcomment.cate == 'IMG') { html += '
上传数
'; } - if (colcomment.cate == 'MD' || colcomment.cate == 'DOWN' || colcomment.cate == 'AV' || colcomment.cate == 'IMG' || colcomment.cate == 'IMG1') { - if (colcomment.cate != 'MD') { + if (colcomment.cate == 'MD' || colcomment.cate == 'FILEMD' || colcomment.cate == 'DOWN' || colcomment.cate == 'AV' || colcomment.cate == 'IMG' || colcomment.cate == 'IMG1') { + if (colcomment.cate != 'MD' || colcomment.cate == 'FILEMD') { html += '
宽高
'; html += '
扩展名
'; } @@ -524,7 +527,7 @@ html += '
压缩范围
'; html += '
savepath
'; } - if (colcomment.cate == 'BR' || colcomment.cate == 'MD') { + if (colcomment.cate == 'BR' || colcomment.cate == 'MD' || colcomment.cate == 'FILEMD') { html += '
列加载
'; html += '
高度
'; } @@ -656,6 +659,18 @@ window.close(); }); } + function safepath() { + var savepc = $5('[name=_bcod_savepc]').val(); + var idx = savepc.lastIndexOf('\\'); + if (idx > 0) { + if (savepc[idx + 1] == '_') { + savepc = savepc.substring(0, idx + 1) + savepc.substring(idx + 2); + } else { + savepc = savepc.substring(0, idx + 1) + '_' + savepc.substring(idx + 1); + } + $5('[name=_bcod_savepc]').val(savepc); + } + } function createhtml(dom) { var postparam = checkformdata(dom); if (typeof (postparam) == 'string') diff --git a/web/admin/develop/code_create.php b/web/admin/develop/code_create.php index 1946a23..8eb2786 100644 --- a/web/admin/develop/code_create.php +++ b/web/admin/develop/code_create.php @@ -55,7 +55,10 @@ class code_create { $subend = substr($dbsaasrow['subpath'], strrpos($dbsaasrow['subpath'], '\\') + 1); if (substr($maintab, 0, strlen($subend)) == $subend) $maintab = substr($maintab, strlen($subend)); + if (substr($maintab, 0, 1) == '_') + $maintab = substr($maintab, 1); $ret['code_create']['bcod']['savepc'] = 'web\\' . $dbsaasrow['subpath'] . '\\' . $maintab; + $ret['code_create']['bcod']['maintab'] = $maintab; $ret['code_create']['bcod']['pctemplate'] = 'sigpage'; $ret['code_create']['bcod']['pcparam'] = ',listchk,'; diff --git a/web/admin/develop/code_list.html b/web/admin/develop/code_list.html index 8e2449d..d5ab9a4 100644 --- a/web/admin/develop/code_list.html +++ b/web/admin/develop/code_list.html @@ -44,10 +44,10 @@ , data: json }); Glob.tabls = {}; - for (var i in json.once.dbcode) - Glob.tabls[json.once.dbcode[i].tabl] = 1; - document.title = '🔆' + json.once.dbsaas.name + ' - ' + json.once.dbsaas.subpath; - $5('#id_dbc').html('' + json.once.dbsaas.name + '' + json.once.dbsaas.schem + '' + json.once.dbsaas.subpath + ''); + for (var i in json.dbcode) + Glob.tabls[json.dbcode[i].tabl] = 1; + document.title = '🔆' + json.dbsaas.name + ' - ' + json.dbsaas.subpath; + $5('#id_dbc').html('' + json.dbsaas.name + '' + json.dbsaas.schem + '' + json.dbsaas.subpath + ''); return json; } , fn_tdcontent: function (key, datashow, field, data) { @@ -96,7 +96,7 @@ function menubtn(dom, btn) { var id = $5(dom).parent('tr').attr('data-id'); if (btn == 'create') { - window.open('code_create.html?dbcid=' + table.once.dbsaas.id + '&table=' + table.data[id].TABLE_NAME); + window.open('code_create.html?dbcid=' + table.json.dbsaas.id + '&table=' + table.data[id].TABLE_NAME); } } diff --git a/web/admin/develop/code_list.php b/web/admin/develop/code_list.php index 47d5457..3a2b014 100644 --- a/web/admin/develop/code_list.php +++ b/web/admin/develop/code_list.php @@ -20,7 +20,7 @@ class code_list { $rows = $db->get($csql); for ($i = 0; $i < count($rows); $i++) $rows[$i]['id'] = $i + 1; - $ret = array('where' => $where, 'list' => $rows); + $ret = array('searchwhere' => $where, 'list' => $rows); if ($post->getbool('field')) { $field = array(); @@ -33,12 +33,7 @@ class code_list { } if ($post->getbool('once')) { - $ret['once'] = array(); - $ret['once']['dbsaas'] = $dbsaasrow; - $csql = new \ciy\sql('zc_dev_dbcode'); - $csql->where('dbcid', getint('dbcid')); - $csql->column('tabl'); - $ret['once']['dbcode'] = $db->get($csql); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'input', @@ -52,7 +47,12 @@ class code_list { 'name' => '英文名', 'prop' => ' style="width:8em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; + $ret['dbsaas'] = $dbsaasrow; + $csql = new \ciy\sql('zc_dev_dbcode'); + $csql->where('dbcid', getint('dbcid')); + $csql->column('tabl'); + $ret['dbcode'] = $db->get($csql); } return succjson($ret); } diff --git a/web/admin/develop/code_pc_html.php b/web/admin/develop/code_pc_html.php index 57a0fd8..3bc0593 100644 --- a/web/admin/develop/code_pc_html.php +++ b/web/admin/develop/code_pc_html.php @@ -46,7 +46,7 @@ function code_pc_html($post) { $chk_getupdate = true; $cate = $fld['cate']; if ( - $cate == 'CATM' || $cate == 'CATS' || $cate == 'MD' || $cate == 'CYC' || $cate == 'LOC' || $cate == 'UNIT' + $cate == 'CATM' || $cate == 'CATS' || $cate == 'MD' || $cate == 'FILEMD' || $cate == 'CYC' || $cate == 'LOC' || $cate == 'UNIT' || $cate == 'TIME' || $cate == 'SEC' || $cate == 'IMG1' || $cate == 'IMG' || $cate == 'DOWN' || $cate == 'AV' ) $ciycmp2 = true; @@ -279,10 +279,10 @@ if($hasedit){ if ($fld['bimp'] && $fld['set']['noup'] != 'view') $labclass .= ' imp'; $clstop = ''; - if($cate == 'MD' || $cate == 'BR' || $cate == 'AV' || $cate == 'IMG' || $cate == 'IMG1') + if($cate == 'MD' || $cate == 'FILEMD' || $cate == 'BR' || $cate == 'AV' || $cate == 'IMG' || $cate == 'IMG1') $clstop = ' top'; $codex .= "\n{$pspec}
"; - if ($cate != 'MD') //富文本编辑器,不加label + if ($cate != 'MD' && $cate != 'FILEMD') //富文本编辑器,不加label $codex .= "\n{$pspec} "; $codex .= "\n{$pspec}
"; $ext = ''; @@ -304,8 +304,8 @@ if($hasedit){ $codex .= "\n{$pspec} "; } else if ($cate == 'WCNY') { $codex .= "\n{$pspec} "; - } else if ($cate == 'MD' || $cate == 'DOWN' || $cate == 'AV' || $cate == 'IMG' || $cate == 'IMG1') { - if ($cate != 'MD') { + } else if ($cate == 'MD' || $cate == 'FILEMD' || $cate == 'DOWN' || $cate == 'AV' || $cate == 'IMG' || $cate == 'IMG1') { + if ($cate != 'MD' && $cate != 'FILEMD') { if ($cate == 'IMG1') $num = 1; else @@ -330,7 +330,7 @@ if($hasedit){ $ext .= ' zipext="' . $fld['set']['fzext'] . '"'; // if(isset($fld['set']['savepath'])) // $ext .= ' path="' . $fld['set']['savepath'] . '"'; - if ($cate == 'MD') + if ($cate == 'MD' || $cate == 'FILEMD') $codex .= "\n{$pspec} "; else $codex .= "\n{$pspec} "; @@ -634,7 +634,35 @@ if($hasedit){ $menubtn .= "\n , name: '{$str}' + table.data[id].name + ''"; $menubtn .= "\n });"; $menubtn .= "\n }"; - }else{ + }else if ($str == '查看') { + $extcls = ' def'; + $extkey = 'view'; + $menubtn .= "\n if (btn == 'view') {"; + $menubtn .= "\n view(id);"; + $menubtn .= "\n }"; + } + else if ($str == '修改') { + $extkey = 'edit'; + $menubtn .= "\n if (btn == 'edit') {"; + $menubtn .= "\n edit(id);"; + $menubtn .= "\n }"; + } + else if ($str == '删除') { + $extcls = ' dag'; + $extkey = 'del'; + $menubtn .= "\n if (btn == 'del') {"; + $menubtn .= "\n ciyfn.callfastfunc(dom, '是否删除?', 'del', { ids: id }, function (json){ table.delline(json) });"; + $menubtn .= "\n }"; + } + else if ($str == '审核') { + $hasreview = true; + $extcls = ''; + $extkey = 'review'; + $menubtn .= "\n if (btn == 'review') {"; + $menubtn .= "\n review(id);"; + $menubtn .= "\n }"; + } + else { if(empty($extkey)) $extkey = $str; $menubtn .= "\n if (btn == '{$extkey}') {"; @@ -727,7 +755,7 @@ if($hasedit){ continue; if ($fld['set']['noup'] == 'view') { - $codex .= "\n $5('[wit={$col}]', dom).html(ciyfn.tdshow(dat.{$col}, table.field.{$col}.ext, dat, table.once, table.json, true));"; + $codex .= "\n $5('[wit={$col}]', dom).html(ciyfn.tdshow('{$col}', dat.{$col}, table.field.{$col}.ext, dat, table.json, true));"; } else if ( $cate == 'FSIZE' || $cate == 'METRE' || $cate == 'DATE' || $cate == 'TIME' || $cate == 'BOOL' || $cate == 'WCNY' || $cate == 'UNIT' || $cate == 'CYC' || $cate == 'SEC' || $cate == 'TON' @@ -745,7 +773,7 @@ if($hasedit){ if (isset($fld['set']['listload']) && $fld['set']['listload'] == 'rel') $range = 'jsndat.' . $dictname; else - $range = 'table.once.' . $dictname; + $range = 'table.json.' . $dictname; } else $range = "'{$dictname}'"; if (isset($fld['set']['dbedit']) && $fld['set']['dbedit'] == 'text') @@ -754,6 +782,19 @@ if($hasedit){ $codex .= "\n ciycmp({ dom: $5('[com={$col}]', dom), value: dat.{$col}, range: {$range} });"; } else if ($cate == 'MD' || $cate == 'DOWN' || $cate == 'AV' || $cate == 'IMG' || $cate == 'IMG1') { $codex .= "\n ciycmp({ dom: $5('[com={$col}]', dom), value: dat.{$col}, path: ciyfn.makeuploadpath('{$fld['set']['savepath']}', ciyfn.getstorage(ciy_vars.tokenfield)) });"; + } else if ($cate == 'FILEMD') { + $codex .= "\n var path = ciyfn.makeuploadpath('{$fld['set']['savepath']}', ciyfn.getstorage(ciy_vars.tokenfield));"; + $codex .= "\n path = path.replace(/{Y}/g, new Date().getFullYear()).replace(/{m}/g, ciyfn.topad0(new Date().getMonth() + 1, 2)).replace(/{d}/g, ciyfn.topad0(new Date().getDate(), 2));"; + $codex .= "\n ciyfn.ajax({"; + $codex .= "\n url: ciyfn.file_stor('/' + path + '/' + dat.id + '_' + dat.{$col} + '.txt')"; + $codex .= "\n , method: 'GET'"; + $codex .= "\n , success: function (res) {"; + $codex .= "\n ciycmp({ dom: $5('[com={$col}]', dom), value: res, path: path });"; + $codex .= "\n }"; + $codex .= "\n , fail: function (res) {"; + $codex .= "\n ciycmp({ dom: $5('[com={$col}]', dom), value: '[MD]', path: path });"; + $codex .= "\n }"; + $codex .= "\n });"; } else if ($cate == 'TBIN') { $codex .= "\n var values = [];"; $codex .= "\n var ibin = parseInt(dat.{$col});"; @@ -828,11 +869,11 @@ if($hasedit){ continue; $sgcol = (isset($fld['set']['colview']) ? $fld['set']['colview'] : '24'); $clstop = ''; - if($cate == 'MD' || $cate == 'BR' || $cate == 'AV' || $cate == 'IMG' || $cate == 'IMG1') + if($cate == 'MD' || $cate == 'FILEMD' || $cate == 'BR' || $cate == 'AV' || $cate == 'IMG' || $cate == 'IMG1') $clstop = ' top'; $codex .= "\n html += '
';"; - $codex .= "\n html += '
';"; - $codex .= "\n html += ciyfn.tdshow(dat.{$col}, table.field.{$col}.ext, dat, table.once, table.json, true);"; + $codex .= "\n html += '
';"; + $codex .= "\n html += ciyfn.tdshow('{$col}', dat.{$col}, table.field.{$col}.ext, dat, table.json, true);"; $codex .= "\n html += ' 
';"; $codex .= "\n"; } @@ -841,6 +882,24 @@ if($hasedit){ $codex .= "\n title: '查看'"; $codex .= "\n , width: 'pc'"; $codex .= "\n , autoheight: true"; + foreach ($flds as $fld) { + if($fld['cate'] == 'FILEMD'){ + $codex .= "\n , fn_showed: function (doc, dom) {"; + $codex .= "\n var path = ciyfn.makeuploadpath('{$fld['set']['savepath']}', ciyfn.getstorage(ciy_vars.tokenfield));"; + $codex .= "\n path = path.replace(/{Y}/g, new Date().getFullYear()).replace(/{m}/g, ciyfn.topad0(new Date().getMonth() + 1, 2)).replace(/{d}/g, ciyfn.topad0(new Date().getDate(), 2));"; + $codex .= "\n ciyfn.ajax({"; + $codex .= "\n url: ciyfn.file_stor('/' + path + '/' + dat.id + '_' + dat.{$fld['col']} + '.txt')"; + $codex .= "\n , method: 'GET'"; + $codex .= "\n , success: function (res) {"; + $codex .= "\n $5('[data-mdver]', dom).html(ciyfn.markdown(res));"; + $codex .= "\n }"; + $codex .= "\n , fail: function (res) {"; + $codex .= "\n $5('[data-mdver]', dom).html('未加载');"; + $codex .= "\n }"; + $codex .= "\n });"; + $codex .= "\n }"; + } + } $codex .= "\n , content: html"; $codex .= "\n });"; $codex .= "\n });"; @@ -864,15 +923,15 @@ if($hasedit){ continue; $sgcol = (isset($fld['set']['colview']) ? $fld['set']['colview'] : '24'); $codex .= "\n html += '
';"; - $codex .= "\n html += '
';"; - $codex .= "\n html += ciyfn.tdshow(dat.{$col}, table.field.{$col}.ext, dat, table.once, table.json, true);"; + $codex .= "\n html += '
';"; + $codex .= "\n html += ciyfn.tdshow('{$col}', dat.{$col}, table.field.{$col}.ext, dat, table.json, true);"; $codex .= "\n html += '
';"; $codex .= "\n"; } foreach ($flds as $fld) { if($fld['col'] == 'auditmsg'){ $codex .= "\n html += '
';"; - $codex .= "\n html += '
';"; + $codex .= "\n html += '
';"; $codex .= "\n html += '';"; $codex .= "\n html += '
';"; } diff --git a/web/admin/develop/code_pc_php.php b/web/admin/develop/code_pc_php.php index 4fdf4dc..0265b21 100644 --- a/web/admin/develop/code_pc_php.php +++ b/web/admin/develop/code_pc_php.php @@ -123,6 +123,9 @@ function code_pc_php($post) { $codex .= "\n \$csqlt->where('name like', \$val);"; $codex .= "\n \$trow = \$db->getone(\$csqlt);"; $codex .= "\n if (is_array(\$trow)) {"; + if ($cate == 'CATS') + $codex .= "\n \$csql->where('{$col} like', ',' . \$trow['id'] . ',');"; + else $codex .= "\n \$csql->where('{$col}', \$trow['id']);"; } $codex .= "\n \$query['{$col}'] = \$trow['name'];"; @@ -197,10 +200,10 @@ function code_pc_php($post) { $codex .= "\n \$pagecount = \$post->getint('pagecount', 10);"; $codex .= "\n \$csql->limit(\$pageno, \$pagecount);"; $codex .= "\n \$mainrowcount = \$post->getint('count');"; - $codex .= "\n \$rows = \$db->get(\$csql, \$mainrowcount);"; - $codex .= "\n if(\$rows === false)"; + $codex .= "\n \$mrows = \$db->get(\$csql, \$mainrowcount);"; + $codex .= "\n if (\$mrows === false)"; $codex .= "\n return errjson(\$db->error);"; - $codex .= "\n \$ret = array('where' => \$where, 'pageno' => \$pageno, 'pagecount' => \$pagecount, 'count' => \$mainrowcount, 'list' => \$rows);"; + $codex .= "\n \$ret = array('searchwhere' => \$where, 'pageno' => \$pageno, 'pagecount' => \$pagecount, 'count' => \$mainrowcount, 'list' => \$mrows);"; $codex .= "\n if (\$post->getbool('field')) {"; $codex .= "\n \$field = array();"; $codex .= "\n \$fshow = \$db->getfield(\$field, '{$tabname}');"; @@ -222,7 +225,7 @@ function code_pc_php($post) { $codex .= "\n \$ret['fshow'] = \$fshow;"; $codex .= "\n }"; $codex .= "\n if (\$post->getbool('once')) {"; - $codex .= "\n \$ret['once'] = array();"; + $codex .= "\n \$ret['once'] = true;"; $codex .= "\n \$input = array();"; foreach ($flds as $fld) { if (!$fld['bqry']) @@ -234,7 +237,7 @@ function code_pc_php($post) { $dbquery = isset($fld['set']['dbquery']) ? $fld['set']['dbquery'] : ''; $pspec = ''; if ($fld['breq']) { - $codex .= "\n if(!get('_{$col}'))"; + $codex .= "\n if (!get('_{$col}'))"; $pspec = ' '; } if ($dbquery == 'window') { @@ -292,7 +295,7 @@ function code_pc_php($post) { } $codex .= "\n \$input[] = array('type' => 'select', 'form' => 'order', 'name' => '排序', 'select' => \$vals);"; } - $codex .= "\n \$ret['once']['input'] = \$input;"; + $codex .= "\n \$ret['searchinput'] = \$input;"; foreach ($flds as $fld) { $cate = $fld['cate']; @@ -304,7 +307,7 @@ function code_pc_php($post) { if ($cate == 'CATM') $ext = ',upid'; $codex .= "\n \$csql = (new \ciy\sql('{$dictname}'))->column('id,name{$ext}');"; - $codex .= "\n \$ret['once']['{$dictname}'] = \$db->get(\$csql);"; + $codex .= "\n \$ret['{$dictname}'] = \$db->get(\$csql);"; } } } @@ -331,7 +334,7 @@ function code_pc_php($post) { } foreach ($rels as $dictname => $cols) { $colsn = implode(',', $cols); - $codex .= "\n \$ret['{$dictname}'] = getrelation(\$db, \$rows, '{$dictname}', '{$colsn}');"; + $codex .= "\n \$ret['{$dictname}'] = getrelation(\$db, \$mrows, '{$dictname}', '{$colsn}');"; } $codex .= "\n return succjson(\$ret);"; $codex .= "\n }"; @@ -352,8 +355,8 @@ function code_pc_php($post) { $codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);"; } $codex .= "\n \$csql->where('id', \$id);"; - $codex .= "\n \$row = \$db->getone(\$csql);"; - $codex .= "\n if (!is_array(\$row))"; + $codex .= "\n \$mrow = \$db->getone(\$csql);"; + $codex .= "\n if (!is_array(\$mrow))"; $codex .= "\n return errjson('数据不存在');"; $codex .= "\n if (\$act == 'view' || \$act == 'review') {"; foreach ($flds as $fld) { @@ -363,7 +366,7 @@ function code_pc_php($post) { list($dicttype, $dictname) = splitdict($fld['data']); if ($dicttype == 'dictdb') { $codex .= "\n \$csql = (new \ciy\sql('{$dictname}'))->column('id,name');"; - $codex .= "\n \$csql->where('id', \$row['{$fld['col']}']);"; + $codex .= "\n \$csql->where('id', \$mrow['{$fld['col']}']);"; $codex .= "\n \$ret['{$dictname}'] = \$db->get(\$csql);"; } } @@ -371,9 +374,9 @@ function code_pc_php($post) { } $codex .= "\n }"; $codex .= "\n } else {"; - $codex .= "\n \$row = array();"; + $codex .= "\n \$mrow = array();"; $codex .= "\n }"; - $codex .= "\n \$ret['data'] = \$row;"; + $codex .= "\n \$ret['data'] = \$mrow;"; $codex .= "\n if (\$act == 'edit') {"; foreach ($flds as $fld) { $cate = $fld['cate']; @@ -401,13 +404,14 @@ function code_pc_php($post) { $codex .= "\n // return errjson('您未被授权操作');"; } $codex .= "\n \$post = new \ciy\post();"; + $codex .= "\n //\$db->trace(\$post->get('_pf'), \$rsuser);"; foreach ($flds as $fld) { $col = $fld['col']; - // if($col == $saasfield || $col == 'addtimes' || $col == 'ip' || $col == 'uptimes') + // if ($col == $saasfield || $col == 'addtimes' || $col == 'ip' || $col == 'uptimes') // continue; - // if($col == 'auditstatus' || $col == 'audittimes' || $col == 'audituser' || $col == 'auditmsg') + // if ($col == 'auditstatus' || $col == 'audittimes' || $col == 'audituser' || $col == 'auditmsg') // continue; - // if($col == 'matterstatus' || $col == 'matternextuser' || $col == 'mattertimes') + // if ($col == 'matterstatus' || $col == 'matternextuser' || $col == 'mattertimes') // continue; if ($col != 'id' && !empty($fld['set']['noup']) && $fld['set']['noup'] != 'fow') continue; @@ -418,7 +422,10 @@ function code_pc_php($post) { $typefc = 'getfloat'; else $typefc = 'get'; - $codex .= "\n \${$col} = \$post->{$typefc}('{$col}');"; + if ($fld['cate'] == 'FILEMD') + $codex .= "\n \${$col}_text = \$post->get('{$col}');"; + else + $codex .= "\n \${$col} = \$post->{$typefc}('{$col}');"; } foreach ($flds as $fld) { if (!$fld['bimp']) @@ -429,10 +436,12 @@ function code_pc_php($post) { $cate = $fld['cate']; $name = $fld['name']; $type = $fld['type']; - if ($type == 'bigint' || $type == 'int' || $type == 'double' || $type == 'float') - $codex .= "\n if (\${$col} == 0)"; - else if ($cate == 'MD') + if ($cate == 'MD') $codex .= "\n if (\${$col} == '[MD]')"; + else if ($cate == 'FILEMD') + $codex .= "\n if (\${$col}_text == '[MD]')"; + else if ($type == 'bigint' || $type == 'int' || $type == 'double' || $type == 'float') + $codex .= "\n if (\${$col} == 0)"; else $codex .= "\n if (empty(\${$col}))"; $codex .= "\n return errjson('请填写{$name}');"; @@ -461,6 +470,12 @@ function code_pc_php($post) { $codex .= "\n if (!is_array(\$datarow))"; $codex .= "\n return errjson('数据不存在');"; } + foreach ($flds as $fld) { + $col = $fld['col']; + if ($fld['cate'] == 'FILEMD'){ + $codex .= "\n \${$col} = (isset(\$datarow['{$col}']) ? \$datarow['{$col}'] + 1 : 1);"; + } + } $codex .= "\n try {"; $codex .= "\n \$db->begin();"; $dups = array(); @@ -488,13 +503,13 @@ function code_pc_php($post) { $col = $fld['col']; if ($col == 'id' || $col == 'addtimes') continue; - // if($col == 'auditstatus' || $col == 'audittimes' || $col == 'audituser' || $col == 'auditmsg') + // if ($col == 'auditstatus' || $col == 'audittimes' || $col == 'audituser' || $col == 'auditmsg') // continue; - // if($col == 'matterstatus' || $col == 'matternextuser' || $col == 'mattertimes') + // if ($col == 'matterstatus' || $col == 'matternextuser' || $col == 'mattertimes') // continue; - // if($col == 'uptimes') + // if ($col == 'uptimes') // $codex .= "\n \$updata['{$col}'] = tostamp();"; - // else if($col == 'ip') + // else if ($col == 'ip') // $codex .= "\n \$updata['{$col}'] = getip();"; if (!empty($fld['set']['noup'])) { if ($fld['set']['noup'] == 'now') @@ -573,6 +588,13 @@ function code_pc_php($post) { $colsn = implode(',', $cols); $codex .= "\n \$ret['{$dictname}'] = getrelation(\$db, [\$updata], '{$dictname}', '{$colsn}');"; } + foreach ($flds as $fld) { + $col = $fld['col']; + if ($fld['cate'] == 'FILEMD'){ + $codex .= "\n if (storsave('/{Y}/{m}{d}/{$fld['set']['savepath']}/' . \$id . '_' . \${$col} . '.txt', \${$col}_text) === false)"; + $codex .= "\n return errjson('写入失败');"; + } + } $codex .= "\n return succjson(\$ret);"; // $codex .= "\n \$csql = new \ciy\sql('{$tabname}');"; // $codex .= "\n \$csql->where('id', \$id);"; @@ -591,6 +613,7 @@ function code_pc_php($post) { $codex .= "\n // return errjson('您未被授权操作');"; } $codex .= "\n \$post = new \ciy\post();"; + $codex .= "\n //\$db->trace(\$post->get('_pf'), \$rsuser);"; $codex .= "\n \$ids = \$post->get('ids');"; $codex .= "\n if (empty(\$ids))"; $codex .= "\n return errjson('请选择至少一条');"; @@ -600,12 +623,12 @@ function code_pc_php($post) { $codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);"; } $codex .= "\n \$csql->where('id in', \$ids);"; - $codex .= "\n \$rows = \$db->get(\$csql);"; + $codex .= "\n \$mrows = \$db->get(\$csql);"; $codex .= "\n \$vids = array();"; $codex .= "\n try {"; $codex .= "\n \$db->begin();"; - $codex .= "\n foreach (\$rows as \$row) {"; - $codex .= "\n \$delid = \$row['id'];"; + $codex .= "\n foreach (\$mrows as \$mrow) {"; + $codex .= "\n \$delid = \$mrow['id'];"; $codex .= "\n //delcheck(\$db, \$delid, 'tablexx', 'xxid', '管理员');"; if ($chk_deltimes) { $codex .= "\n //deltimeall(\$db, \$delid, 'tablexx', 'xxid', '运动员');"; @@ -614,7 +637,7 @@ function code_pc_php($post) { $codex .= "\n //delall(\$db, \$delid, 'tablexx', 'xxid', '运动员'); //deltimeall"; $codex .= "\n delme(\$db, \$delid, '{$tabname}');"; } - $codex .= "\n savelogdb(\$db, \$rsuser['id'], '{$tabname}', \$row, null);"; + $codex .= "\n savelogdb(\$db, \$rsuser['id'], '{$tabname}', \$mrow, null);"; $codex .= "\n \$vids[] = \$delid;"; $codex .= "\n }"; $codex .= "\n \$db->commit();"; @@ -638,6 +661,7 @@ function code_pc_php($post) { $codex .= "\n // return errjson('您未被授权操作');"; } $codex .= "\n \$post = new \ciy\post();"; + $codex .= "\n //\$db->trace(\$post->get('_pf'), \$rsuser);"; $codex .= "\n \$ids = \$post->get('ids');"; $codex .= "\n if (empty(\$ids))"; $codex .= "\n return errjson('请选择至少一条');"; @@ -655,11 +679,11 @@ function code_pc_php($post) { $codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);"; } $codex .= "\n \$csql->where('id in', \$ids);"; - $codex .= "\n \$rows = \$db->get(\$csql);"; + $codex .= "\n \$mrows = \$db->get(\$csql);"; $codex .= "\n \$ids = array();"; $codex .= "\n try {"; $codex .= "\n \$db->begin();"; - $codex .= "\n foreach (\$rows as \$row) {"; + $codex .= "\n foreach (\$mrows as \$mrow) {"; $codex .= "\n if (\$auditstatus == 100) {"; $codex .= "\n }"; $codex .= "\n \$updata = array();"; @@ -675,10 +699,10 @@ function code_pc_php($post) { $codex .= "\n \$updata['{$col}'] = \$auditmsg;"; } $codex .= "\n \$csql = new \ciy\sql('{$tabname}');"; - $codex .= "\n \$csql->where('id', \$row['id']);"; + $codex .= "\n \$csql->where('id', \$mrow['id']);"; $codex .= "\n if (\$db->update(\$csql, \$updata) === false)"; $codex .= "\n throw new \Exception('审核失败:' . \$db->error);"; - $codex .= "\n \$ids[] = \$row['id'];"; + $codex .= "\n \$ids[] = \$mrow['id'];"; $codex .= "\n }"; $codex .= "\n \$db->commit();"; $codex .= "\n } catch (\Exception \$ex) {"; @@ -702,6 +726,7 @@ function code_pc_php($post) { $codex .= "\n // return errjson('您未被授权操作');"; } $codex .= "\n \$post = new \ciy\post();"; + $codex .= "\n //\$db->trace(\$post->get('_pf'), \$rsuser);"; $codex .= "\n \$status = \$post->getint('status');"; $codex .= "\n \$ids = \$post->get('ids');"; $codex .= "\n if (empty(\$ids))"; @@ -712,18 +737,18 @@ function code_pc_php($post) { $codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);"; } $codex .= "\n \$csql->where('id in', \$ids);"; - $codex .= "\n \$rows = \$db->get(\$csql);"; + $codex .= "\n \$mrows = \$db->get(\$csql);"; $codex .= "\n \$ids = array();"; $codex .= "\n try {"; $codex .= "\n \$db->begin();"; - $codex .= "\n foreach (\$rows as \$row) {"; + $codex .= "\n foreach (\$mrows as \$mrow) {"; $codex .= "\n \$updata = array();"; $codex .= "\n \$updata['status'] = \$status;"; $codex .= "\n \$csql = new \ciy\sql('{$tabname}');"; - $codex .= "\n \$csql->where('id', \$row['id']);"; + $codex .= "\n \$csql->where('id', \$mrow['id']);"; $codex .= "\n if (\$db->update(\$csql, \$updata) === false)"; $codex .= "\n throw new \Exception('批量操作失败:' . \$db->error);"; - $codex .= "\n \$ids[] = \$row['id'];"; + $codex .= "\n \$ids[] = \$mrow['id'];"; $codex .= "\n }"; $codex .= "\n \$db->commit();"; $codex .= "\n } catch (\Exception \$ex) {"; @@ -747,9 +772,9 @@ function code_pc_php($post) { $codex .= "\n \$post = new \\ciy\\post();"; $codex .= "\n list(\$where, \$csql) = self::setwhere(\$db, \$post, \$rsuser);"; - $codex .= "\n \$rows = \$db->get(\$csql);"; - $codex .= "\n if (count(\$rows) > 10000)"; - $codex .= "\n return errjson('将导出' . count(\$rows) . '条,不建议超过1万条,请筛选缩小范围');"; + $codex .= "\n \$mrows = \$db->get(\$csql);"; + $codex .= "\n if (count(\$mrows) > 10000)"; + $codex .= "\n return errjson('将导出' . count(\$mrows) . '条,不建议超过1万条,请筛选缩小范围');"; $codex .= "\n \$fields = array();"; foreach ($flds as $fld) { if (!$fld['bout']) @@ -789,7 +814,7 @@ function code_pc_php($post) { $codex .= "\n \$code_{$col} = \$db->get((new \\ciy\\sql('{$dictname}'))->column('id,name{$ext}'));"; } else if ($dicttype == 'dictdb') { if (isset($fld['set']['listload']) && $fld['set']['listload'] == 'rel') - $codex .= "\n \$code_{$col} = getrelation(\$db, \$rows, '{$dictname}', '{$col}', 'id,name{$ext}');"; + $codex .= "\n \$code_{$col} = getrelation(\$db, \$mrows, '{$dictname}', '{$col}', 'id,name{$ext}');"; else $codex .= "\n \$code_{$col} = \$db->get((new \\ciy\\sql('{$dictname}'))->column('id,name{$ext}'));"; } else if ($dicttype == 'dictcata') { @@ -800,11 +825,11 @@ function code_pc_php($post) { } } $codex .= "\n \$datas = array();"; - $codex .= "\n foreach (\$rows as \$row) {"; + $codex .= "\n foreach (\$mrows as \$mrow) {"; $codex .= "\n \$dat = array();"; $codex .= "\n foreach (\$fields as \$field) {"; $codex .= "\n \$field = \$field['field'];"; - $codex .= "\n \$val = isset(\$row[\$field]) ? \$row[\$field] : '';"; + $codex .= "\n \$val = isset(\$mrow[\$field]) ? \$mrow[\$field] : '';"; foreach ($flds as $fld) { if ($fld['col'] != 'id' && !$fld['bout']) @@ -947,6 +972,8 @@ function code_pc_php($post) { foreach ($flds as $fld) { $col = $fld['col']; + if ($fld['cate'] == 'FILEMD') + continue; if ($col == 'id') { $codex .= "\n \$headsn[] = '行码.id';"; continue; @@ -1050,6 +1077,8 @@ function code_pc_php($post) { if ($fld['col'] == 'id' || !$fld['bmin']) continue; $col = $fld['col']; + if($col == 'FILEMD') + continue; $name = $fld['name']; $cate = $fld['cate']; $type = $fld['type']; @@ -1271,6 +1300,7 @@ function code_pc_php($post) { $codex .= "\n //if (nopower(\$db, \$rsuser['id'], 'p i'))"; $codex .= "\n // return errjson('您未被授权操作');"; $codex .= "\n \$post = new \ciy\post();"; + $codex .= "\n //\$db->trace(\$post->get('_pf'), \$rsuser);"; $codex .= "\n \$total = \$post->getint('total');"; $codex .= "\n try {"; $codex .= "\n \$db->begin();"; @@ -1305,6 +1335,8 @@ function code_pc_php($post) { $col = $fld['col']; if ($col == 'id') continue; + if ($fld['cate'] == 'FILEMD') + continue; $codex .= "\n \$updata['{$col}'] = \$post->get('{$col}_' . \$i);"; } $codex .= "\n \$csql = new \ciy\sql('{$tabname}');"; diff --git a/web/admin/develop/code_saas.php b/web/admin/develop/code_saas.php index f6d9263..daa3824 100644 --- a/web/admin/develop/code_saas.php +++ b/web/admin/develop/code_saas.php @@ -24,7 +24,7 @@ class code_saas { $rows = $db->get($csql, $mainrowcount); if ($rows === false) return errjson($db->error); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, 'zc_dev_dbsaas'); @@ -37,7 +37,7 @@ class code_saas { $ret['fshow'] = $fshow; } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; } return succjson($ret); } diff --git a/web/admin/rigger/admin.go b/web/admin/rigger/admin.go index 29e2c78..0bd8484 100644 --- a/web/admin/rigger/admin.go +++ b/web/admin/rigger/admin.go @@ -90,10 +90,10 @@ func Admin_init(w http.ResponseWriter, r *http.Request) bool { csql = c.NewCiySQL("zc_depart") csql.Column("id,upid,name,isuse") - once["zc_depart"], _, _ = c.CiyDB.Get(csql) + ret["zc_depart"], _, _ = c.CiyDB.Get(csql) csql = c.NewCiySQL("zc_role") csql.Column("id,name") - once["zc_role"], _, _ = c.CiyDB.Get(csql) + ret["zc_role"], _, _ = c.CiyDB.Get(csql) ret["once"] = once } return c.SuccJSON(w, r, ret) diff --git a/web/admin/rigger/admin.html b/web/admin/rigger/admin.html index c7bc631..a4aeb1c 100644 --- a/web/admin/rigger/admin.html +++ b/web/admin/rigger/admin.html @@ -87,7 +87,7 @@
- +
@@ -145,7 +145,7 @@ , pagecount: 10 , fn_beforedata: function (json) { if (json.once) - filldepart(json.once.zc_depart); + filldepart(json.zc_depart); ciyfn.fillsearch({ searchdom: '.search' , data: json @@ -213,8 +213,8 @@ ciycmp({ dom: $5('[com=icon]', dom), value: table.data[id].icon }); ciycmp({ dom: $5('[com=stpstatus]', dom), value: table.data[id].stpstatus, range: 'stpstatus' }); ciycmp({ dom: $5('[com=sex]', dom), value: table.data[id].sex, range: 'sex' }); - ciycmp({ dom: $5('[com=departid]', dom), value: table.data[id].departid, range: table.once.zc_depart }); - ciycmp({ dom: $5('[com=roleid]', dom), value: table.data[id].roleid, range: table.once.zc_role }); + ciycmp({ dom: $5('[com=departid]', dom), value: table.data[id].departid, range: table.json.zc_depart }); + ciycmp({ dom: $5('[com=roleid]', dom), value: table.data[id].roleid, range: table.json.zc_role }); } , btns: ["提交", "*关闭"] , cb: function (opn) { diff --git a/web/admin/rigger/admin.php b/web/admin/rigger/admin.php index b43a249..1c0b59b 100644 --- a/web/admin/rigger/admin.php +++ b/web/admin/rigger/admin.php @@ -30,7 +30,7 @@ class admin { $csql->limit($pageno, $pagecount); $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, 'zc_admin'); @@ -44,7 +44,7 @@ class admin { } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'input', @@ -75,12 +75,12 @@ class admin { 'form' => 'addtimes', 'name' => '注册时间' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; $csql = (new \ciy\sql('zc_depart'))->column('id,upid,name,isuse'); - $ret['once']['zc_depart'] = $db->get($csql); + $ret['zc_depart'] = $db->get($csql); $csql = new \ciy\sql('zc_role'); $csql->column('id,name'); - $ret['once']['zc_role'] = $db->get($csql); + $ret['zc_role'] = $db->get($csql); } return succjson($ret); } diff --git a/web/admin/rigger/autotask.php b/web/admin/rigger/autotask.php index c516189..0543ca5 100644 --- a/web/admin/rigger/autotask.php +++ b/web/admin/rigger/autotask.php @@ -27,7 +27,7 @@ class autotask { $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); $rows[] = array('id' => '', 'runcycle' => 0, 'nexttimes' => tostamp()); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, 'zc_autotask'); @@ -40,7 +40,7 @@ class autotask { $ret['fshow'] = $fshow; } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'input', @@ -54,7 +54,7 @@ class autotask { 'name' => '入口函数', 'prop' => ' style="width:8em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } diff --git a/web/admin/rigger/autotskrun.go b/web/admin/rigger/autotskrun.go index 6d64626..910ee65 100644 --- a/web/admin/rigger/autotskrun.go +++ b/web/admin/rigger/autotskrun.go @@ -76,7 +76,7 @@ func Autotskrun_init(w http.ResponseWriter, r *http.Request) bool { once["input"] = input csql = c.NewCiySQL("zc_autotask") csql.Column("id,name") - once["zc_autotask"], _, _ = c.CiyDB.Get(csql) + ret["zc_autotask"], _, _ = c.CiyDB.Get(csql) ret["once"] = once } return c.SuccJSON(w, r, ret) diff --git a/web/admin/rigger/autotskrun.php b/web/admin/rigger/autotskrun.php index db3045b..0b17653 100644 --- a/web/admin/rigger/autotskrun.php +++ b/web/admin/rigger/autotskrun.php @@ -26,7 +26,7 @@ class autotskrun { $csql->limit($pageno, $pagecount); $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, 'zc_autotsk_run'); @@ -40,7 +40,7 @@ class autotskrun { } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'daterange', 'form' => 'addtimes', 'name' => '执行时间' @@ -54,9 +54,9 @@ class autotskrun { $input[] = array( 'type' => 'input', 'form' => 'msg', 'name' => '任务简报', 'prop' => ' style="width:8em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; $csql = (new \ciy\sql('zc_autotask'))->column('id,name'); - $ret['once']['zc_autotask'] = $db->get($csql); + $ret['zc_autotask'] = $db->get($csql); } return succjson($ret); } diff --git a/web/admin/rigger/cata.go b/web/admin/rigger/cata.go index c1f4b76..70d9c86 100644 --- a/web/admin/rigger/cata.go +++ b/web/admin/rigger/cata.go @@ -101,10 +101,10 @@ func Cata_init(w http.ResponseWriter, r *http.Request) bool { }) } once["input"] = input - once["cbid"] = cbid - once["issub"] = issub - once["ismulti"] = ismulti - once["code"] = code + ret["cbid"] = cbid + ret["issub"] = issub + ret["ismulti"] = ismulti + ret["codename"] = code ret["once"] = once } return c.SuccJSON(w, r, ret) diff --git a/web/admin/rigger/cata.html b/web/admin/rigger/cata.html index 8e4cb57..4615faa 100644 --- a/web/admin/rigger/cata.html +++ b/web/admin/rigger/cata.html @@ -33,7 +33,7 @@ 全选 反选 | - 批量删除 + 批量删除
@@ -98,17 +98,17 @@ , url: 'init' , thfield: function (name, key, field, json) { if (key == 'name') { - if (table.once.issub) + if (table.json.issub) return ' ' + ciyfn.lang(name); } } , fn_beforedata: function (json) { json.list = ciyfn.conv_treerow(json.list, 0, 0); if (json.once) { - if (!json.once.ismulti) + if (!json.ismulti) $5('.btn-multi').hide('', 0, true); else - $5('#id_code').text(json.once.code).show(); + $5('#id_code').text(json.codename).show(); } ciyfn.fillsearch({ searchdom: '.search' @@ -137,14 +137,14 @@ html += '新增'; else html += '更新'; - if (data['id'] > 0 && table.once.issub) + if (data['id'] > 0 && table.json.issub) html += '添加子码'; return html; } if (key == 'name') { if (data['id'] == 0) { var html = ''; - if (table.once.issub) + if (table.json.issub) html += ''; html += ''; return { divprop: ' style="display: flex;"', datashow: html }; @@ -213,7 +213,7 @@ , cb: function (opn) { if (opn.btn == "关闭") return opn.close(); - var txt = 'rigger/cata.html?cbid=' + table.once.cbid; + var txt = 'rigger/cata.html?cbid=' + table.json.cbid; if (opn.inputs.issub == 1) txt += '&issub=yes'; if (opn.inputs.ismulti == 1) @@ -241,7 +241,7 @@ postparam.upid = domselect.attr('data-id'); } } - postparam.cbid = table.once.cbid; + postparam.cbid = table.json.cbid; ciyfn.callfunc('update', postparam, function (json) { $5(dom).addClass('def'); if (id == 0) { @@ -285,7 +285,7 @@ if (opn.btn == "关闭") return opn.close(); opn.inputs.upid = upid; - opn.inputs.cbid = table.once.cbid; + opn.inputs.cbid = table.json.cbid; if (ciyfn.throttle(opn.dombtn)) return; ciyfn.callfunc('multiadd', opn.inputs, function (json) { opn.close(); diff --git a/web/admin/rigger/cata.php b/web/admin/rigger/cata.php index e671b93..0238769 100644 --- a/web/admin/rigger/cata.php +++ b/web/admin/rigger/cata.php @@ -56,7 +56,7 @@ class cata { $ret['field'] = $field; } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'input', @@ -78,11 +78,11 @@ class cata { 'prop' => ' style="width:8em;"' ); } - $ret['once']['input'] = $input; - $ret['once']['cbid'] = $cbid; - $ret['once']['issub'] = $issub; - $ret['once']['ismulti'] = $ismulti; - $ret['once']['code'] = $code; + $ret['searchinput'] = $input; + $ret['cbid'] = $cbid; + $ret['issub'] = $issub; + $ret['ismulti'] = $ismulti; + $ret['codename'] = $code; } return succjson($ret); } @@ -224,6 +224,9 @@ class cata { $codes = explode("\n", str_replace(',', ',', $code)); $cnt = 0; + $deepids = array(); + $deepids[0] = $upid; + $lastdeep = 0; try { $db->begin(); if (count($codes) == 1 && strpos($code, ',') !== false && strpos($code, ':') !== false) { @@ -237,20 +240,30 @@ class cata { $name = $cs[1]; if (empty($name)) continue; + $deep = 0; + while (true) { + if (substr($name, 0, 2) != '--') + break; + $deep++; + $name = trim(substr($name, 2)); + } + if (empty($name)) + continue; + if ($lastdeep < $deep) + throw new \Exception('不能跳跃层级:' . $name); $csql = new \ciy\sql('zc_cata'); $csql->where('cbid', $cbid)->where('codeid', $codeid); $chkrow = $db->getone($csql); $updata = array(); - $updata['upid'] = $upid; + $updata['upid'] = $deepids[$deep]; $updata['name'] = $name; $csql = new \ciy\sql('zc_cata'); if (is_array($chkrow)) { - $chkid = $chkrow['id']; - $csql->where('id', $chkid); + $id = $chkrow['id']; + $csql->where('id', $id); if ($db->update($csql, $updata) === false) throw new \Exception('批量更新失败.' . $db->error); } else { - $chkid = 0; $updata['isuse'] = 1; $updata['cbid'] = $cbid; $updata['codeid'] = $codeid; @@ -260,6 +273,8 @@ class cata { $id = $db->insert_id(); } $updata['id'] = $id; + $deepids[$deep + 1] = $id; + $lastdeep = $deep + 1; savelogdb($db, $rsuser['id'], 'zc_cata', $chkrow, $updata); $cnt++; } @@ -275,21 +290,31 @@ class cata { $name = $cs[1]; $codeid = $cs[0]; } + $deep = 0; + while (true) { + if (substr($name, 0, 2) != '--') + break; + $deep++; + $name = trim(substr($name, 2)); + } + if (empty($name)) + continue; + if ($lastdeep < $deep) + throw new \Exception('不能跳跃层级:' . $name); $csql = new \ciy\sql('zc_cata'); $csql->where('cbid', $cbid)->where('codeid', $codeid); $chkrow = $db->getone($csql); $updata = array(); - $updata['upid'] = $upid; + $updata['upid'] = $deepids[$deep]; $updata['name'] = $name; $updata['extdata'] = @$cs[2] . ''; $csql = new \ciy\sql('zc_cata'); if (is_array($chkrow)) { - $chkid = $chkrow['id']; - $csql->where('id', $chkid); + $id = $chkrow['id']; + $csql->where('id', $id); if ($db->update($csql, $updata) === false) throw new \Exception('批量更新失败.' . $db->error); } else { - $chkid = 0; $updata['isuse'] = 1; $updata['cbid'] = $cbid; $updata['codeid'] = $codeid; @@ -297,6 +322,8 @@ class cata { if ($db->insert($csql, $updata) === false) throw new \Exception('批量新增失败.' . $db->error); $id = $db->insert_id(); + $deepids[$deep + 1] = $id; + $lastdeep = $deep + 1; } $updata['id'] = $id; savelogdb($db, $rsuser['id'], 'zc_cata', $chkrow, $updata); diff --git a/web/admin/rigger/cataindex.php b/web/admin/rigger/cataindex.php index fb9d1a5..52a4ee7 100644 --- a/web/admin/rigger/cataindex.php +++ b/web/admin/rigger/cataindex.php @@ -27,7 +27,7 @@ class cataindex { $ret['fshow'] = $fshow; } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'input', @@ -47,7 +47,7 @@ class cataindex { 'name' => '引用表', 'prop' => ' style="width:10em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } diff --git a/web/admin/rigger/config.php b/web/admin/rigger/config.php index 7b6b71d..ba5add2 100644 --- a/web/admin/rigger/config.php +++ b/web/admin/rigger/config.php @@ -24,7 +24,7 @@ class config { $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); $rows[] = array('id' => 0, 'types' => ''); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = ''; @@ -37,7 +37,7 @@ class config { $ret['field'] = $field; } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'input', 'form' => 'types', 'name' => '参数代码', 'prop' => ' style="width:8em;"' @@ -45,7 +45,7 @@ class config { $input[] = array( 'type' => 'input', 'form' => 'params', 'name' => '参数值', 'prop' => ' style="width:8em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } diff --git a/web/admin/rigger/crawtable.php b/web/admin/rigger/crawtable.php index 61bcfc6..6d03e9c 100644 --- a/web/admin/rigger/crawtable.php +++ b/web/admin/rigger/crawtable.php @@ -24,7 +24,7 @@ class crawtable { $csql->limit($pageno, $pagecount); $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, $table); @@ -37,12 +37,12 @@ class crawtable { } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'input', 'form' => 'name', 'name' => '名称' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } diff --git a/web/admin/rigger/debug_user.php b/web/admin/rigger/debug_user.php index 75e0174..6146ace 100644 --- a/web/admin/rigger/debug_user.php +++ b/web/admin/rigger/debug_user.php @@ -26,7 +26,7 @@ class debug_user { $csql->limit($pageno, $pagecount); $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, 'zc_debug_user'); @@ -36,7 +36,7 @@ class debug_user { } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'select', 'form' => 'targettype', 'name' => '子系统', 'select' => 'targettype', 'all' => '全部' @@ -54,7 +54,7 @@ class debug_user { $input[] = array( 'type' => 'input', 'form' => 'user', 'name' => '用户名', 'prop' => ' style="width:8em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } diff --git a/web/admin/rigger/depart.html b/web/admin/rigger/depart.html index 20aec03..35791f0 100644 --- a/web/admin/rigger/depart.html +++ b/web/admin/rigger/depart.html @@ -207,7 +207,7 @@ continue; menutxt += indent + tdata[i].name + '\n'; if (tdata[i].upid === upid) - menutxt += deeptxt(tdata, tdata[i].id, indent + ' '); + menutxt += deeptxt(tdata, tdata[i].id, indent + '--'); } return menutxt; } diff --git a/web/admin/rigger/depart.php b/web/admin/rigger/depart.php index 52927fd..79c5e70 100644 --- a/web/admin/rigger/depart.php +++ b/web/admin/rigger/depart.php @@ -21,12 +21,15 @@ class depart { $ret['fshow'] = $fshow; } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( - 'type' => 'input', 'form' => 'name', 'name' => '组织名称', 'prop' => ' style="width:8em;"' + 'type' => 'input', + 'form' => 'name', + 'name' => '组织名称', + 'prop' => ' style="width:8em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } @@ -34,7 +37,7 @@ class depart { public static function json_update() { global $db; $rsuser = verifyfast(); - + if (nopower($db, $rsuser['id'], 'p501u')) return errjson('您未被授权操作'); $post = new \ciy\post(); @@ -78,7 +81,7 @@ class depart { public static function json_del() { global $db; $rsuser = verifyfast(); - + if (nopower($db, $rsuser['id'], 'p501d')) return errjson('您未被授权操作'); $post = new \ciy\post(); @@ -111,7 +114,7 @@ class depart { public static function json_modifyupid() { global $db; $rsuser = verifyfast(); - + if (nopower($db, $rsuser['id'], 'p501u')) return errjson('您未被授权操作'); $post = new \ciy\post(); @@ -143,7 +146,7 @@ class depart { public static function json_multiadd() { global $db; $rsuser = verifyfast(); - + if (nopower($db, $rsuser['id'], 'p501u')) return errjson('您未被授权操作'); $post = new \ciy\post(); @@ -151,21 +154,37 @@ class depart { $multi = explode("\n", $post->get('multi')); $cnt = 0; + $deepids = array(); + $deepids[0] = $upid; + $lastdeep = 0; try { $db->begin(); foreach ($multi as $m) { $m = trim($m); if (empty($m)) continue; + $deep = 0; + while (true) { + if (substr($m, 0, 2) != '--') + break; + $deep++; + $m = trim(substr($m, 2)); + } + if (empty($m)) + continue; + if ($lastdeep < $deep) + throw new \Exception('不能跳跃层级:' . $m); $updata = array(); $updata['name'] = $m; $updata['isuse'] = 1; - $updata['upid'] = $upid; + $updata['upid'] = $deepids[$deep]; $updata['csort'] = 10; $csql = new \ciy\sql('zc_depart'); if ($db->insert($csql, $updata) === false) throw new \Exception('新增失败:' . $db->error); $updata['id'] = $db->insert_id(); + $deepids[$deep + 1] = $updata['id']; + $lastdeep = $deep + 1; $cnt++; savelogdb($db, $rsuser['id'], 'zc_depart', null, $updata); } diff --git a/web/admin/rigger/funcslow.php b/web/admin/rigger/funcslow.php index 1622fac..2dae420 100644 --- a/web/admin/rigger/funcslow.php +++ b/web/admin/rigger/funcslow.php @@ -25,7 +25,7 @@ class funcslow { $csql->limit($pageno, $pagecount); $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, 'zc_funcslow'); @@ -37,7 +37,7 @@ class funcslow { } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'daterange', 'form' => 'addtimes', 'name' => '记录时间' @@ -51,7 +51,7 @@ class funcslow { $input[] = array( 'type' => 'input', 'form' => 'posts', 'name' => '参数', 'prop' => ' style="width:8em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } diff --git a/web/admin/rigger/logdb.php b/web/admin/rigger/logdb.php index 2b88a09..569095c 100644 --- a/web/admin/rigger/logdb.php +++ b/web/admin/rigger/logdb.php @@ -31,7 +31,7 @@ class logdb { $csql->limit($pageno, $pagecount); $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, 'zc_log'); @@ -40,7 +40,7 @@ class logdb { } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'select', @@ -75,7 +75,7 @@ class logdb { 'name' => '详情', 'prop' => ' style="width:8em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } diff --git a/web/admin/rigger/luser.php b/web/admin/rigger/luser.php index d742fda..9c03aad 100644 --- a/web/admin/rigger/luser.php +++ b/web/admin/rigger/luser.php @@ -27,7 +27,7 @@ class luser { $csql->limit($pageno, $pagecount); $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, 'zc_luser'); @@ -36,7 +36,7 @@ class luser { } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'select', @@ -56,7 +56,7 @@ class luser { 'form' => 'model', 'name' => '设备指纹', ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } diff --git a/web/admin/rigger/menu.html b/web/admin/rigger/menu.html index 2e127e9..b312c03 100644 --- a/web/admin/rigger/menu.html +++ b/web/admin/rigger/menu.html @@ -135,7 +135,7 @@ return ''; } if (key == 'url' || key == 'csort' || key == 'pow') { - return ''; + return ''; } if (key == 'icon') { if (data['upid'] == 1) @@ -145,28 +145,28 @@ if (data['_deep'] > 0) return ''; if (data[key] && data[key].substring(0, 4) == '' + data[key] + '
'; + return '
' + data[key] + '
'; else - return '
' + Glob.ciysvg + '
'; + return '
' + Glob.ciysvg + '
'; } if (key == 'demo') { var demo = data["url"].split('~')[1] || ""; - return ''; + return ''; } if (key == '_btn') { - var html = '' + (data['id'] == 0 ? '新增' : '更新') + ''; - html += '调整'; + var html = '' + (data['id'] == 0 ? '新增' : '更新') + ''; + html += '调整'; return html; } if (key == 'name') { var deep = toint(data['_deep']); var html = ' '.repeat(deep); if (data['_count'] > 0) { - html += ' '; + html += ' '; } else { if (deep > 0) html += '  '; - html += ''; + html += ''; } return { divprop: (data['_count'] > 0 ? ' data-treeid="' + data['id'] + '"' : '') + ' data-deep="' + data['_deep'] + '" style="display: flex;" class="ciy-tree-spread"'// class="ciy-tree-spread" @@ -277,7 +277,7 @@ continue; menutxt += indent + tdata[i].name + '\n'; if (tdata[i].upid === upid) - menutxt += deeptxt(tdata, tdata[i].id, indent + ' '); + menutxt += deeptxt(tdata, tdata[i].id, indent + '--'); } return menutxt; } @@ -303,7 +303,6 @@ var postparam = ciyfn.getform(dom, 'TR'); postparam.id = id; postparam.upid = table.data[id].upid; - postparam.cbid = table.once.cbid; ciyfn.callfunc('update', postparam, function (json) { $5(dom).addClass('def'); $5('[name=url]', domtr).val(json.url); diff --git a/web/admin/rigger/menu.php b/web/admin/rigger/menu.php index bdfffe4..25da2c1 100644 --- a/web/admin/rigger/menu.php +++ b/web/admin/rigger/menu.php @@ -34,15 +34,21 @@ class menu { $ret['fshow'] = $fshow; } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( - 'type' => 'input', 'form' => 'name', 'name' => '名称', 'prop' => ' style="width:8em;"' + 'type' => 'input', + 'form' => 'name', + 'name' => '名称', + 'prop' => ' style="width:8em;"' ); $input[] = array( - 'type' => 'input', 'form' => 'url', 'name' => '链接', 'prop' => ' style="width:12em;"' + 'type' => 'input', + 'form' => 'url', + 'name' => '链接', + 'prop' => ' style="width:12em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } @@ -197,15 +203,30 @@ class menu { $multi = explode("\n", $post->get('multi')); $cnt = 0; + $deepids = array(); + $deepids[0] = $upid; + $lastdeep = 0; try { $db->begin(); foreach ($multi as $m) { - if (empty(trim($m))) + $m = trim($m); + if (empty($m)) + continue; + $deep = 0; + while (true) { + if (substr($m, 0, 2) != '--') + break; + $deep++; + $m = trim(substr($m, 2)); + } + if (empty($m)) continue; $ms = explode('~', $m); $name = trim($ms[0]); - if(empty($name)) + if (empty($name)) continue; + if ($lastdeep < $deep) + throw new \Exception('不能跳跃层级:' . $m); $updata = array(); $updata['name'] = $name; if (count($ms) > 1) @@ -213,12 +234,14 @@ class menu { if (count($ms) > 2) $updata['pow'] = trim($ms[2]); $updata['isuse'] = 1; - $updata['upid'] = $upid; + $updata['upid'] = $deepids[$deep]; $updata['csort'] = 10; $csql = new \ciy\sql('zc_menu'); if ($db->insert($csql, $updata) === false) throw new \Exception('操作数据库失败.' . $db->error); $updata['id'] = $db->insert_id(); + $deepids[$deep + 1] = $updata['id']; + $lastdeep = $deep + 1; $cnt++; savelogdb($db, $rsuser['id'], 'zc_menu', null, $updata); } diff --git a/web/admin/rigger/mock.php b/web/admin/rigger/mock.php index 2b2c696..1f7eb7e 100644 --- a/web/admin/rigger/mock.php +++ b/web/admin/rigger/mock.php @@ -24,7 +24,7 @@ class mock { $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); $rows[] = array('id' => 0, 'name' => '', 'ufunc' => '', 'mockjson' => '{"code":1}'); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = ''; @@ -37,7 +37,7 @@ class mock { $ret['field'] = $field; } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'input', 'form' => 'name', 'name' => '名称', 'prop' => ' style="width:8em;"' @@ -45,7 +45,7 @@ class mock { $input[] = array( 'type' => 'input', 'form' => 'ufunc', 'name' => '类.函数', 'prop' => ' style="width:8em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } diff --git a/web/admin/rigger/online.php b/web/admin/rigger/online.php index a7693cb..1d2a42b 100644 --- a/web/admin/rigger/online.php +++ b/web/admin/rigger/online.php @@ -24,7 +24,7 @@ class online { $csql->limit($pageno, $pagecount); $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, 'zc_online'); @@ -34,7 +34,7 @@ class online { } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'daterange', @@ -53,7 +53,7 @@ class online { 'form' => 'ip', 'name' => '登录IP' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } diff --git a/web/admin/rigger/power.php b/web/admin/rigger/power.php index b1db6eb..03f2b59 100644 --- a/web/admin/rigger/power.php +++ b/web/admin/rigger/power.php @@ -25,7 +25,7 @@ class power { $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); $rows[] = array('id' => 0, 'groupname' => '', 'name' => '', 'scope' => '', 'csort' => 10, 'powers' => ''); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = ''; @@ -44,7 +44,7 @@ class power { $ret['field'] = $field; } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'input', 'form' => 'groupname', 'name' => '分组名', 'prop' => ' style="width:8em;"' @@ -55,7 +55,7 @@ class power { $input[] = array( 'type' => 'input', 'form' => 'scope', 'name' => '模块代码', 'prop' => ' style="width:8em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } diff --git a/web/admin/rigger/role.php b/web/admin/rigger/role.php index 2a07181..e3b86ae 100644 --- a/web/admin/rigger/role.php +++ b/web/admin/rigger/role.php @@ -23,7 +23,7 @@ class role { $csql->limit($pageno, $pagecount); $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, 'zc_role'); @@ -38,7 +38,7 @@ class role { } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'input', 'form' => 'name', 'name' => '角色名称', 'prop' => ' style="width:8em;"' @@ -46,7 +46,7 @@ class role { $input[] = array( 'type' => 'input', 'form' => 'memo', 'name' => '角色说明', 'prop' => ' style="width:8em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } diff --git a/web/admin/rigger/statsfunc.php b/web/admin/rigger/statsfunc.php index 28407d9..c6ccae3 100644 --- a/web/admin/rigger/statsfunc.php +++ b/web/admin/rigger/statsfunc.php @@ -26,7 +26,7 @@ class statsfunc { $csql->limit($pageno, $pagecount); $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, 'zc_stats'); @@ -35,7 +35,7 @@ class statsfunc { } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'daterange', 'form' => 'addtimes', 'name' => '记录时间' @@ -52,7 +52,7 @@ class statsfunc { $input[] = array( 'type' => 'num', 'form' => 'func_runms', 'name' => '平均用时', 'prop' => ' style="width:4em;"' ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; } return succjson($ret); } diff --git a/web/ambap/common.php b/web/ambap/common.php index b55e2f5..24f0e58 100644 --- a/web/ambap/common.php +++ b/web/ambap/common.php @@ -22,6 +22,7 @@ $_token['swapsec'] = 3600; //更换JWT时间 $_token['expsec'] = 86400; //过期退出时间 $_token['field'] = 'ciyap'; $_token['salt'] = 'ast34h$3'; //做数据加解密时的加密因子,每个项目都不要相同。 +$_token['maindomain'] = 'https://ciyon.ciy.cn/ajax/ambap/'; //一般用于api回调 function verifyfast() { $rsuser = verifyuser(); diff --git a/web/ambap/demo/demo.php b/web/ambap/demo/demo.php index dd5f011..0282140 100644 --- a/web/ambap/demo/demo.php +++ b/web/ambap/demo/demo.php @@ -51,7 +51,7 @@ class demo { $csql->limit($pageno, $pagecount); $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); - $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, 'demo_normal'); @@ -69,7 +69,7 @@ class demo { } if ($post->getbool('once')) { - $ret['once'] = array(); + $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'input', @@ -146,10 +146,10 @@ class demo { 'name' => '排序', 'select' => $vals ); - $ret['once']['input'] = $input; + $ret['searchinput'] = $input; $csql = (new \ciy\sql('zc_depart'))->column('id,name,upid'); - $ret['once']['zc_depart'] = $db->get($csql); //列表数据较少,一次性加载 - $ret['once']['ppint'] = $db->getdbcodes('demo_normal', 'ppint'); + $ret['zc_depart'] = $db->get($csql); //列表数据较少,一次性加载 + $ret['ppint'] = $db->getdbcodes('demo_normal', 'ppint'); } $ret['xa_user'] = getrelation($db, $rows, 'xa_user', 'audituser'); //列表数据较多,按需加载 $ret['zc_menu'] = getrelation($db, $rows, 'zc_menu', 'menuid'); //列表数据较多,按需加载 @@ -205,9 +205,8 @@ class demo { $imgs = $post->get('imgs'); $ton = $post->getint('ton'); $price = $post->getint('price'); - $lat = $post->getfloat('lat'); - $lng = $post->getfloat('lng'); - $nums = $post->getfloat('nums'); + $lat = $post->getint('lat'); + $lng = $post->getint('lng'); $pct = $post->getint('pct'); $url = $post->get('url'); $weightg = $post->getint('weightg'); @@ -262,7 +261,6 @@ class demo { $updata['price'] = $price; $updata['lat'] = $lat; $updata['lng'] = $lng; - $updata['nums'] = $nums; $updata['pct'] = $pct; $updata['url'] = $url; $updata['weightg'] = $weightg; @@ -399,7 +397,6 @@ class demo { $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'price', 'name' => '单价'); $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'lat', 'name' => '纬度'); $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'lng', 'name' => '位置'); - $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'nums', 'name' => '监管数量'); $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'url', 'name' => '链接'); $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'idcard', 'name' => '身份证号'); $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'weightg', 'name' => '体重'); @@ -558,7 +555,6 @@ class demo { $headsn[] = '单价.price'; $headsn[] = '纬度.lat'; $headsn[] = '位置.lng'; - $headsn[] = '监管数量.nums'; $headsn[] = '链接.url'; $headsn[] = '身份证号.idcard'; $headsn[] = '体重.weightg'; @@ -1003,7 +999,6 @@ class demo { $price = $post->get('price_' . $i); $lat = $post->get('lat_' . $i); $lng = $post->get('lng_' . $i); - $nums = $post->get('nums_' . $i); $url = $post->get('url_' . $i); $idcard = $post->get('idcard_' . $i); $weightg = $post->get('weightg_' . $i); @@ -1040,7 +1035,6 @@ class demo { $updata['price'] = $price; $updata['lat'] = $lat; $updata['lng'] = $lng; - $updata['nums'] = $nums; $updata['url'] = $url; $updata['idcard'] = $idcard; $updata['weightg'] = $weightg; diff --git a/web/ambap/login.php b/web/ambap/login.php index 6493c4f..44d0005 100644 --- a/web/ambap/login.php +++ b/web/ambap/login.php @@ -44,7 +44,7 @@ class login { } $authtime = $post->getint('auth'); if (abs($authtime / 1000 - tostamp()) > 300) - return errjson('您的本地时间与服务器时间相差超过5分钟,请调整本机时间。
服务器时间: ' . date('Y-m-d H:i:s') . '
您本机时间: ' . date('Y-m-d H:i:s', $authtime / 1000)); + return errjson('您的本地时间与服务器时间相差超过5分钟,请调整本机时间。
服务器时间: ' . date('Y-m-d H:i:s') . '
您本机时间: ' . date('Y-m-d H:i:s', (int)($authtime / 1000))); // if($user == '1') // clog(md5('1' . $_token['salt'])); //开发生成默认密码 if ($post->get('pass') != md5($rsuser['password'] . $authtime)) { @@ -361,12 +361,19 @@ class login { $ret['me']['mobile'] = $userrow['mobile']; $ret['me']['name'] = $userrow['name']; $ret['me']['userlevel'] = $userrow['userlevel']; - $ret['me']['myinvmoney'] = $userrow['myinvmoney']; + $ret['me']['mymoney'] = $userrow['mymoney']; $ret['me']['mycashmoney'] = $userrow['mycashmoney']; + $ret['me']['myinvmoney'] = $userrow['myinvmoney']; $ret['me']['mybondmoney'] = $userrow['mybondmoney']; $ret['me']['mypnt'] = $userrow['mypnt']; $ret['me']['certs'] = $userrow['certs']; $ret['me']['needpass'] = empty($userrow['password']); + $csql = new \ciy\sql('zc_debug_user'); + $csql->where('targettype', 21); + $csql->where('isuse', 1); + $csql->where('user', $userrow['mobile']); + $ret['me']['dbg'] = is_array($db->getone($csql)); + $csql = new \ciy\sql('ap_usr_ext'); $csql->where('id', $userrow['id']); $extrow = $db->getone($csql); @@ -375,11 +382,12 @@ class login { $ret['me']['email'] = $extrow['email']; $ret['me']['wxno'] = $extrow['wxno']; $ret['me']['idid'] = $extrow['idid']; - $ret['me']['cciy'] = $extrow['cciy']; + $ret['me']['cciy'] = $extrow['cciy'] . ''; $ret['me']['cashtype'] = $extrow['cashtype']; $ret['me']['bankno'] = $extrow['bankno']; $ret['me']['bankname'] = $extrow['bankname']; $ret['me']['bankaccount'] = $extrow['bankaccount']; + $ret['me']['bankcode'] = $extrow['bankcode']; } else { $ret['me']['truename'] = ''; } @@ -393,7 +401,7 @@ class login { } return succjson(); } - public static function json_debug() { + public static function json_debug_list() { global $db; $csql = new \ciy\sql('zc_debug_user'); $csql->where('targettype', 21); @@ -401,6 +409,38 @@ class login { $ret['list'] = $db->get($csql); return succjson($ret); } + public static function json_debug_chguser() { + global $db; + global $_token; + $post = new \ciy\post(); + $usercode = $post->getint('code'); + $csql = new \ciy\sql('zc_debug_user'); + $csql->where('id', $usercode); + $dbguser = $db->getone($csql); + if ($dbguser === false) + return errjson($db->error); + if (!is_array($dbguser)) + return errjson('用户code不存在'); + $csql = new \ciy\sql('ap_user'); + $csql->where('mobile', $dbguser['user']); + $rsuser = $db->getone($csql); + if (!is_array($rsuser)) + return errjson('用户不存在'); + $sid = randstr(10); + $exp = tostamp() + $_token['swapsec']; + $id = $rsuser['id']; + $updata = array(); + $updata['logintimes'] = tostamp(); + $updata['trytime'] = 0; + $updata['sid'] = $sid; + $updata['exptimes'] = $exp; + $updata['ip'] = getip(); + $csql = new \ciy\sql('ap_user'); + $csql->where('id', $id); + if ($db->update($csql, $updata) === false) + return errjson('user数据库更新失败:' . $db->error); + return self::getsync($rsuser, $sid); + } private static function saveluser($db, $isinout, $userid, $model = '') { $updata = array(); $updata['isinout'] = $isinout; diff --git a/web/ambap/index.php b/web/ambap/main.php similarity index 66% rename from web/ambap/index.php rename to web/ambap/main.php index c936cba..dff1b05 100644 --- a/web/ambap/index.php +++ b/web/ambap/main.php @@ -2,69 +2,77 @@ namespace web\ambap; -class index { - public static function json_init() { +class main { + + + + + + public static function json_pnt_up() { global $db; + $rsuser = verifyfast(); $post = new \ciy\post(); - $ret['once'] = array(); - $csql = new \ciy\sql('ap_banner'); - $csql->where('groupcode', 'index'); - $row = $db->get($csql); - $ret['once']['banner'] = $row; - $csql = new \ciy\sql('demo_normal'); - $csql->order('id desc'); - $csql->limit(1, 8); - $rows = $db->get($csql); - $ret['demos'] = $rows; - $ret['zc_menu'] = getrelation($db, $rows, 'zc_menu', 'menuid', 'id,name'); - $ret['sharename'] = '分享主标题,千人千面'; + $id = $post->getint('id'); + $csql = new \ciy\sql('ap_pnt_track'); + $csql->where('id', $id); + $trackrow = $db->getone($csql); + if (!is_array($trackrow)) + return errjson('埋点不存在' . $id); + $point = $trackrow['point']; + $updata = array(); + $updata['vuser'] = $rsuser['id']; + $updata['fromid'] = $id; + $updata['name'] = $trackrow['name']; + $updata['pnt'] = $point; + $updata['addtimes'] = tostamp(); + $csql = new \ciy\sql('ap_pnt_record'); + $db->insert($csql, $updata); + $db->execute('update ap_user set mypnt=mypnt+' . $point . ' where id=' . $rsuser['id']); + $msg = ''; + if ($id == 1) + $msg = '已签到 +' . $point . ' 积分'; + $ret['msg'] = $msg; return succjson($ret); } - public static function json_paper() { + public static function json_signpath() { + $rsuser = verifyfast(); + $post = new \ciy\post(); + $path = $post->get('path'); //'/pages/main/index'; + $ret['sign'] = hash_hmac('sha256', $path, $rsuser['wxminakey'], false); + $ret['path'] = $path; + return succjson($ret); + } + public static function json_part_vent() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $id = $post->getint('id'); + $sectionid = $post->getint('sectionid'); + $content = $post->get('content'); + $updata = array(); + $updata['artid'] = $id; + $updata['sectionid'] = $sectionid; + $updata['content'] = $content; + $updata['pubtimes'] = time(); + $updata['audituser'] = 0; + $updata['vuser'] = $rsuser['id']; + $csql = new \ciy\sql('ap_art_vent'); + $db->insert($csql, $updata); + return succjson(); + } + public static function json_part_hot() { global $db; $post = new \ciy\post(); $id = $post->getint('id'); - $csql = new \ciy\sql('ap_paper'); - $csql->where('id', $id); - $artrow = $db->getone($csql); - if (!is_array($artrow)) - return errjson('文章不存在' . $id); - $ret = array('data' => $artrow); + $sec = $post->getint('sec'); $updata = array(); - $updata['readcnt'] = array('readcnt+1'); - $csql = new \ciy\sql('ap_paper'); + $updata['studycnt'] = array('studycnt+1'); + $csql = new \ciy\sql('ap_art_post'); $csql->where('id', $id); $db->update($csql, $updata); - return succjson($ret); + return succjson(); } - public static function json_section_get() { - global $db; - $post = new \ciy\post(); - $sectionid = $post->getint('id'); - $csql = new \ciy\sql('ap_art_section'); - $csql->where('id', $sectionid); - $sectionrow = $db->getone($csql); - if (!is_array($sectionrow)) - return errjson('板块不存在' . $sectionid); - $query = $post->get('query'); - $csql = new \ciy\sql('ap_art_post'); - $csql->where('sectionid', $sectionid); - $csql->where('artstatus', 100); - $csql->where('name like', objstr($query, 'key')); - $csql->column('id,name,img,descs'); - $csql->order('artsort desc, id desc'); - $pageno = $post->getint('pageno', 1); - $pagecount = $post->getint('pagecount', 10); - $csql->limit($pageno, $pagecount); - $rows = $db->get($csql); - $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); - if ($post->getbool('once')) { - $ret['once'] = array(); - $ret['once']['section'] = $sectionrow; - } - return succjson($ret); - } - public static function json_art_read() { + public static function json_part_init() { global $db; $post = new \ciy\post(); $id = $post->getint('id'); @@ -88,34 +96,92 @@ class index { $db->update($csql, $updata); return succjson($ret); } - public static function json_art_hot() { + public static function json_psection_list() { global $db; $post = new \ciy\post(); - $id = $post->getint('id'); - $sec = $post->getint('sec'); - $updata = array(); - $updata['studycnt'] = array('studycnt+1'); + $sectionid = $post->getint('id'); + $csql = new \ciy\sql('ap_art_section'); + $csql->where('id', $sectionid); + $sectionrow = $db->getone($csql); + if (!is_array($sectionrow)) + return errjson('板块不存在' . $sectionid); + $query = $post->get('query'); $csql = new \ciy\sql('ap_art_post'); + $csql->where('sectionid', $sectionid); + $csql->where('artstatus', 100); + $csql->where('name like', objstr($query, 'key')); + $csql->column('id,name,img,descs'); + $csql->order('artsort desc, id desc'); + $pageno = $post->getint('pageno', 1); + $pagecount = $post->getint('pagecount', 10); + $csql->limit($pageno, $pagecount); + $rows = $db->get($csql); + $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); + if ($post->getbool('once')) { + $ret['once'] = true; + $ret['section'] = $sectionrow; + } + return succjson($ret); + } + public static function json_paper_get() { + global $db; + $post = new \ciy\post(); + $db->trace($post->get('_pf')); + $id = $post->getint('id'); + $csql = new \ciy\sql('ap_paper'); + $csql->where('id', $id); + $artrow = $db->getone($csql); + if (!is_array($artrow)) + return errjson('文章不存在' . $id); + $ret = array('data' => $artrow); + $updata = array(); + $updata['readcnt'] = array('readcnt+1'); + $csql = new \ciy\sql('ap_paper'); $csql->where('id', $id); $db->update($csql, $updata); - return succjson(); + return succjson($ret); } - public static function json_art_vent() { + public static function json_index_init() { global $db; - $rsuser = verifyfast(); $post = new \ciy\post(); - $id = $post->getint('id'); - $sectionid = $post->getint('sectionid'); - $content = $post->get('content'); - $updata = array(); - $updata['artid'] = $id; - $updata['sectionid'] = $sectionid; - $updata['content'] = $content; - $updata['pubtimes'] = time(); - $updata['audituser'] = 0; - $updata['vuser'] = $rsuser['id']; - $csql = new \ciy\sql('ap_art_vent'); - $db->insert($csql, $updata); - return succjson(); + $csql = new \ciy\sql('ap_banner'); + $csql->where('groupcode', 'index'); + $row = $db->get($csql); + $ret['banner'] = $row; + $csql = new \ciy\sql('demo_normal'); + $csql->order('id desc'); + $csql->limit(1, 8); + $rows = $db->get($csql); + $ret['demos'] = $rows; + $ret['zc_menu'] = getrelation($db, $rows, 'zc_menu', 'menuid', 'id,name'); + $ret['sharename'] = '分享主标题,千人千面'; + return succjson($ret); } + public static function json_me_init() { + global $db; + $csql = new \ciy\sql('ap_usr_buy_bundle'); + $ret['userbuys'] = $db->get($csql); + $ret['recommend'] = 2; + return succjson($ret); + } + + + + + + + + + + + + + + + + + + + + } \ No newline at end of file diff --git a/web/ambap/me.php b/web/ambap/me.php index 2693345..6f067d8 100644 --- a/web/ambap/me.php +++ b/web/ambap/me.php @@ -3,24 +3,565 @@ namespace web\ambap; class me { - - public static function json_signpath() { - $rsuser = verifyfast(); - $post = new \ciy\post(); - $path = $post->get('path');//'/pages/main/index'; - $ret['sign'] = hash_hmac('sha256', $path, $rsuser['wxminakey'], false); - $ret['path'] = $path; - return succjson($ret); - } - public static function json_invoicetitle_get() { + + public static function json_user_bank_change() { global $db; $rsuser = verifyfast(); - $csql = new \ciy\sql('ap_usr_invoicetitle'); + $post = new \ciy\post(); + $bankno = $post->get('bankno'); + $bankname = $post->get('bankname'); + $bankaccount = $post->get('bankaccount'); + $bankcode = $post->get('bankcode'); + $updata = array(); + $updata['bankno'] = $bankno; + $updata['bankname'] = $bankname; + $updata['bankaccount'] = $bankaccount; + $updata['bankcode'] = $bankcode; + $csql = new \ciy\sql('ap_usr_ext'); + $csql->where('id', $rsuser['id']); + $extrow = $db->getone($csql); + if (is_array($extrow)) { + if ($db->update($csql, $updata) === false) + return errjson('ext更新失败:' . $db->error); + } else { + $updata['id'] = $rsuser['id']; + if ($db->insert($csql, $updata) === false) + return errjson('ext新增失败:' . $db->error); + } + return succjson(); + } + public static function json_cashout_lst_list() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $query = $post->get('query'); + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('vuser', $rsuser['id']); + $liid = $post->getint('liid'); + if ($liid > 0) + $csql->where('cashstatus', $liid); + $csql->order(objstr($query, 'order', 'id desc')); + $pageno = $post->getint('pageno', 1); + $pagecount = $post->getint('pagecount', 10); + $csql->limit($pageno, $pagecount); + $rows = $db->get($csql); + $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); + return succjson($ret); + } + public static function json_cashout_cash_inv() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $id = $post->getint('id'); + $invcode = $post->get('invcode'); + $invfile = $post->get('invfile'); + if (empty($invcode)) + return errjson('请填写发票编号'); + if (empty($invfile)) + return errjson('请上传发票'); + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('vuser', $rsuser['id']); + $csql->where('id', $id); + $cashoutrow = $db->getone($csql); + if (!is_array($cashoutrow)) + return errjson('提现不存在'); + if ($cashoutrow['cashstatus'] != 20) + return errjson('提现不是已通过状态'); + try { + $db->begin(); + $updata = array(); + $updata['cashstatus'] = 30; + $updata['invcode'] = $invcode; + $updata['invfile'] = $invfile; + $updata['cashtimes'] = tostamp(); + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('id', $id); + if ($db->update($csql, $updata) === false) + throw new \Exception('更新失败:' . $db->error); + $updata['id'] = $id; + $db->commit(); + } catch (\Exception $ex) { + $db->rollback(); + return errjson($ex->getMessage()); + } + $ret['data'] = $updata; + return succjson($ret); + } + public static function json_cashout_cash_wxrecvpay() { + global $db; + global $_token; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $id = $post->getint('id'); + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('id', $id); + $cashrow = $db->getone($csql); + if (!is_array($cashrow)) + return errjson('提现不存在'); + if ($cashrow['cashstatus'] == 21) { + if ($cashrow['cashtimes'] > tostamp() - 86400) + return errjson('提现打款进程被打断。24小时后重新操作,请务必点击收款'); + } else if ($cashrow['cashstatus'] != 20) + return errjson('提现不是已通过状态'); + if ($cashrow['vuser'] != $rsuser['id']) + return errjson('提现用户不匹配'); + $updata = array(); + $updata['cashstatus'] = 21; + $updata['cashtimes'] = tostamp(); + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('id', $id); + if ($db->update($csql, $updata) === false) + return errjson('更新失败'); + + $cashmoney = $cashrow['cashmoney']; + if ($cashrow['taxmoney'] > 0) + $cashmoney -= $cashrow['taxmoney']; + $param = array(); + $param['out_bill_no'] = 'TB' . date('ymd') . '8' . $id; + $param['transfer_scene_id'] = '1005'; + $param['openid'] = $rsuser['wxminaid']; + $param['notify_url'] = $_token['maindomain'] . 'wxpay.transfer'; + $param['transfer_remark'] = '佣金奖励'; + $param['transfer_amount'] = $cashmoney; + $param['transfer_scene_report_infos'] = array(); + $param['transfer_scene_report_infos'][] = array('info_type' => '岗位类型', 'info_content' => '采集员'); + $param['transfer_scene_report_infos'][] = array('info_type' => '报酬说明', 'info_content' => '用户主动申请提现'); + + $wxcfg = gettoken($db, 1); + $wxpay = new \ciy\wxfunc($wxcfg); + $rettransfer = $wxpay->transfer($param); + if (is_string($rettransfer)) + return errjson($rettransfer); + $rettransfer['mchid'] = $wxpay->mchid; + $rettransfer['appid'] = $wxpay->appid; + $ret['transfer'] = $rettransfer; + return succjson($ret); + } + private static function caltax($money) { + if ($money <= 80000) + return 0; + if ($money <= 400000) + $taxable_income = $money - 80000; + else + $taxable_income = $money * 0.8; + if ($taxable_income <= 2000000) + return toint($taxable_income * 0.2); + else if ($taxable_income <= 5000000) + return toint($taxable_income * 0.3 - 200000); + else + return toint($taxable_income * 0.4 - 700000); + } + public static function json_cashout_cash_submit() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $cashtype = $post->getint('cashtype'); + $cash = $post->getint('cash'); + if ($rsuser['mycashmoney'] < $cash) + return errjson('余额不足'); + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('vuser', $rsuser['id']); + $csql->where('cashstatus<90'); + $chkrow = $db->getone($csql); + if (is_array($chkrow)) + return errjson('有未处理提现'); + $taxperson = true; + if ($cashtype == 1) { + $csql = new \ciy\sql('ap_usr_ext'); + $csql->where('id', $rsuser['id']); + $extrow = $db->getone($csql); + if (!is_array($extrow)) + return errjson('用户信息不存在'); + if (empty($extrow['truename'])) + return errjson('请先完善个人信息'); + if ($extrow['truename'] != $extrow['bankaccount']) + $taxperson = false; + } + $taxmoney = -1; + if ($taxperson) { + $monthstart = strtotime(date('Y-m-01')); + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('vuser', $rsuser['id']); + $csql->where('cashstatus=100'); + $csql->where('addtimes>=', $monthstart); + $cashoutrows = $db->get($csql); + $totalcash = 0; + $totaltax = 0; + foreach ($cashoutrows as $cashoutrow) { + $totalcash += $cashoutrow['cashmoney']; + $totaltax += $cashoutrow['taxmoney']; + } + $taxmoney = self::caltax($totalcash + $cash) - $totaltax; + } + try { + $db->begin(); + $updata = array(); + $updata['mycashmoney'] = array('mycashmoney-' . $cash); + $csql = new \ciy\sql('ap_user'); + $csql->where('id', $rsuser['id']); + if ($db->update($csql, $updata) === false) + throw new \Exception('更新账户失败:' . $db->error); + $updata = array(); + $updata['cashstatus'] = 10; + $updata['cashmoney'] = $cash; + $updata['taxmoney'] = $taxmoney; + $updata['cashtype'] = $cashtype; + $updata['vuser'] = $rsuser['id']; + $updata['addtimes'] = tostamp(); + if ($cashtype == 1) { + $updata['bankaccount'] = $extrow['bankaccount']; + $updata['bankno'] = $extrow['bankno']; + $updata['bankname'] = $extrow['bankname']; + $updata['bankcode'] = $extrow['bankcode']; + } + $csql = new \ciy\sql('ap_cash_out'); + if ($db->insert($csql, $updata) === false) + throw new \Exception('创建失败:' . $db->error); + $db->commit(); + } catch (\Exception $ex) { + $db->rollback(); + return errjson($ex->getMessage()); + } + return succjson(); + } + public static function json_cashout_cash_init() { + global $db; + $rsuser = verifyfast(); + $csql = new \ciy\sql('ap_user'); + $csql->where('id', $rsuser['id']); + $csql->column('myinvmoney,mycashmoney,mybondmoney'); + $ret['user'] = $db->getone($csql); + $csql = new \ciy\sql('ap_cash_out'); + $csql->where('vuser', $rsuser['id']); + $csql->where('cashstatus<90'); + $ret['cashs'] = $db->get($csql); + $ret['tip'] = '[MD] +每天可提交1次,以元为单位申请。 +非对公提现,平台代扣缴劳务个税。 +多次提现以本月1日开始累计计算个税。 +由于微信支付限制,申请提现平台审核通过后,需手动点击收款操作。 +'; + return succjson($ret); + } + public static function json_user_info_change() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $name = $post->get('name'); + $icon = $post->get('icon'); + $mobile = $post->get('mobile'); + $wxno = $post->get('wxno'); + $email = $post->get('email'); + if (empty($name)) + return errjson('姓名不能为空'); + if (!ismobile($mobile)) + return errjson('手机号码格式不正确'); + if (empty($email)) { + if (ismail($email)) + return errjson('邮箱格式不正确'); + } + $updata = array(); + $updata['name'] = $name; + $updata['icon'] = $icon; + $updata['mobile'] = $mobile; + $csql = new \ciy\sql('ap_user'); + $csql->where('id', $rsuser['id']); + if ($db->update($csql, $updata) === false) + return errjson('更新失败:' . $db->error); + $updata = array(); + $updata['wxno'] = $wxno; + $updata['email'] = $email; + $csql = new \ciy\sql('ap_usr_ext'); + $csql->where('id', $rsuser['id']); + $extrow = $db->getone($csql); + if (is_array($extrow)) { + if ($db->update($csql, $updata) === false) + return errjson('ext更新失败:' . $db->error); + } else { + $updata['id'] = $rsuser['id']; + if ($db->insert($csql, $updata) === false) + return errjson('ext新增失败:' . $db->error); + } + return succjson(); + } + public static function json_cashie_lst_list() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $query = $post->get('query'); + $csql = new \ciy\sql('ap_cash_ie'); + $csql->where('vuser', $rsuser['id']); + $liid = $post->getint('liid'); + if ($liid == 1) + $csql->where('iemoney>0'); + if ($liid == 2) + $csql->where('iemoney<0'); + $csql->order(objstr($query, 'order', 'id desc')); + $pageno = $post->getint('pageno', 1); + $pagecount = $post->getint('pagecount', 10); + $csql->limit($pageno, $pagecount); + $rows = $db->get($csql); + $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); + return succjson($ret); + } + public static function json_cashin_lst_list() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $query = $post->get('query'); + $csql = new \ciy\sql('ap_cash_in'); + $csql->where('paytimes>0'); + $csql->where('vuser', $rsuser['id']); + $csql->order(objstr($query, 'order', 'id desc')); + $pageno = $post->getint('pageno', 1); + $pagecount = $post->getint('pagecount', 10); + $csql->limit($pageno, $pagecount); + $rows = $db->get($csql); + $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); + return succjson($ret); + } + public static function json_cash_charge_chk() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $id = $post->getint('orderid'); + for ($i = 0; $i < 10; $i++) { + $csql = new \ciy\sql('ap_cash_in'); + $csql->where('id', $id); + $buyrow = $db->getone($csql); + if (!is_array($buyrow)) + return errjson('订单不存在'); + if ($buyrow['paytimes'] > 0) + return succjson(); + sleep(1); + } + return errjson('充值不成功,请联系客服'); + } + public static function json_cash_charge_pay() { + global $db; + global $_token; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $money = $post->getint('money'); + $updata = array(); + $updata['name'] = ''; + $updata['inmoney'] = $money; + $updata['vuser'] = $rsuser['id']; + $updata['addtimes'] = tostamp(); + $updata['paytimes'] = 0; + $csql = new \ciy\sql('ap_cash_in'); + if ($db->insert($csql, $updata) === false) + return errjson('订单创建失败:' . $db->error); + $orderid = $db->insert_id(); + $param = array(); + $param['description'] = '充值'; + $param['out_trade_no'] = 'IN' . date('ymd') . '2' . $orderid; + $param['notify_url'] = $_token['maindomain'] . 'wxpay.charge'; + $param['amount'] = array(); + $param['amount']['total'] = (int)$money; + $param['payer'] = array(); + $param['payer']['openid'] = $rsuser['wxminaid']; + $wxcfg = gettoken($db, 1); + $wxpay = new \ciy\wxfunc($wxcfg); + $retpay = $wxpay->pay($param); + if (is_string($retpay)) + return errjson($retpay); + $retpay['orderid'] = $orderid; + return succjson($retpay); + } + public static function json_cash_charge_init() { + global $db; + $csql = new \ciy\sql('ap_cash_bundle'); + $ret['charges'] = $db->get($csql); + return succjson($ret); + } + public static function json_pnt_buylst_list() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $query = $post->get('query'); + $csql = new \ciy\sql('ap_pnt_buy'); + $csql->where('vuser', $rsuser['id']); + $csql->where('paytimes>0'); + $csql->order(objstr($query, 'order', 'id desc')); + $pageno = $post->getint('pageno', 1); + $pagecount = $post->getint('pagecount', 10); + $csql->limit($pageno, $pagecount); + $rows = $db->get($csql); + $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); + return succjson($ret); + } + public static function json_pnt_buynow_chk() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $id = $post->getint('orderid'); + for ($i = 0; $i < 10; $i++) { + $csql = new \ciy\sql('ap_pnt_buy'); + $csql->where('id', $id); + $buyrow = $db->getone($csql); + if (!is_array($buyrow)) + return errjson('订单不存在'); + if ($buyrow['paytimes'] > 0) + return succjson(); + sleep(1); + } + return errjson('支付不成功,请联系客服'); + } + + public static function json_pnt_buynow_pay() { + global $db; + global $_token; + $rsuser = verifyfast(); + //建立订单,支付 + $post = new \ciy\post(); + $id = $post->getint('id'); + $csql = new \ciy\sql('ap_pnt_bundle'); + $csql->where('id', $id); + $bundlerow = $db->getone($csql); + if (!is_array($bundlerow)) + return errjson('购买项目不存在'); + $payprice = $bundlerow['buymoney']; + $updata = array(); + $updata['pnt'] = $bundlerow['buypnt']; + $updata['buypntmoney'] = $payprice; + $updata['vuser'] = $rsuser['id']; + $updata['addtimes'] = tostamp(); + + $csql = new \ciy\sql('ap_pnt_buy'); + if ($db->insert($csql, $updata) === false) + return errjson('订单创建失败:' . $db->error); + $orderid = $db->insert_id(); + $param = array(); + $param['description'] = '购买金币'; + $param['out_trade_no'] = 'PT' . date('ymd') . '9' . $orderid; + $param['notify_url'] = $_token['maindomain'] . 'wxpay.pay_pnt'; + $param['amount'] = array(); + $param['amount']['total'] = (int)$payprice; + $param['payer'] = array(); + $param['payer']['openid'] = $rsuser['wxminaid']; + $wxcfg = gettoken($db, 1); + $wxpay = new \ciy\wxfunc($wxcfg); + $retpay = $wxpay->pay($param); + if (is_string($retpay)) + return errjson($retpay); + $retpay['orderid'] = $orderid; + return succjson($retpay); + } + public static function json_pnt_buynow_init() { + global $db; + $csql = new \ciy\sql('ap_pnt_bundle'); + $ret['buys'] = $db->get($csql); + return succjson($ret); + } + public static function json_pnt_lst_list() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $query = $post->get('query'); + $csql = new \ciy\sql('ap_pnt_record'); + $csql->where('vuser', $rsuser['id']); + $csql->order(objstr($query, 'order', 'id desc')); + $pageno = $post->getint('pageno', 1); + $pagecount = $post->getint('pagecount', 10); + $csql->limit($pageno, $pagecount); + $rows = $db->get($csql); + $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); + return succjson($ret); + } + public static function json_safe_ccub_init() { + global $db; + $rsuser = verifyfast(); + $csql = new \ciy\sql('dao_ccub_apply'); $csql->where('vuser', $rsuser['id']); $csql->order('id desc'); - $ret['list'] = $db->get($csql); + $ret['data'] = $db->getone($csql); + if (is_array($ret['data'])) + $ret['data']['cciy'] = $ret['data']['cciy'] . ''; + $ret['tip'] = '[MD] +打造一人一码的唯一标识。 +申请标识后可参与众产投票。 +#主体国籍 +#多国身份 +在非主体国拥有居留、永居、入籍等身份。 +与普通公民有同种社会标识的情况。 +'; return succjson($ret); } + public static function json_safe_ccub_submit() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $country = $post->get('country'); + if (empty($country)) + return errjson('主体国籍不能为空'); + $dualcitizen = $post->getint('dualcitizen'); + $csql = new \ciy\sql('ap_usr_ext'); + $csql->where('id', $rsuser['id']); + $usrextrow = $db->getone($csql); + if (!is_array($usrextrow)) + return errjson('用户不存在'); + $updata = array(); + $updata['auditstatus'] = 20; + $updata['vuser'] = $rsuser['id']; + $updata['name'] = $usrextrow['truename']; + $updata['idid'] = $usrextrow['idid']; + $updata['country'] = $country; + $updata['dualcitizen'] = $dualcitizen; + $updata['addtimes'] = tostamp(); + $csql = new \ciy\sql('dao_ccub_apply'); + if ($db->insert($csql, $updata) === false) + return errjson('新增失败:' . $db->error); + return succjson(); + } + public static function json_safe_real_init() { + global $db; + $rsuser = verifyfast(); + $csql = new \ciy\sql('ap_usr_real_apply'); + $csql->where('vuser', $rsuser['id']); + $csql->order('id desc'); + $ret['data'] = $db->getone($csql); + return succjson($ret); + } + public static function json_safe_real_submit() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $name = $post->get('name'); + if (empty($name)) + return errjson('姓名不能为空.'); + $idid = idcard($post->get('idid')); + if (is_string($idid)) + return errjson($idid); + $idcard1 = $post->get('idcard1'); + $idcard2 = $post->get('idcard2'); + $updata = array(); + $updata['auditstatus'] = 20; + $updata['vuser'] = $rsuser['id']; + $updata['name'] = $name; + $updata['idid'] = $idid['code']; + $updata['idcard1'] = $idcard1; + $updata['idcard2'] = $idcard2; + $updata['addtimes'] = tostamp(); + $csql = new \ciy\sql('ap_usr_real_apply'); + if ($db->insert($csql, $updata) === false) + return errjson('新增失败:' . $db->error); + return succjson(); + } + public static function json_invoicetitle_del() { + global $db; + $rsuser = verifyfast(); + if ($rsuser === null) + return errjson('您还未登陆', 2); + $post = new \ciy\post(); + $id = $post->getint('id'); + $csql = new \ciy\sql('ap_invoicetitle'); + $csql->where('vuser', $rsuser['id']); + $csql->where('id', $id); + if ($db->delete($csql) === false) + return errjson('删除失败:' . $db->error); + return succjson(); + } public static function json_invoicetitle_edit() { global $db; $rsuser = verifyfast(); @@ -29,7 +570,7 @@ class me { $post = new \ciy\post(); $id = $post->getint('id'); if ($id > 0) { - $csql = new \ciy\sql('ap_usr_invoicetitle'); + $csql = new \ciy\sql('ap_invoicetitle'); $csql->where('vuser', $rsuser['id']); $csql->where('id', $id); $shiprow = $db->getone($csql); @@ -52,7 +593,7 @@ class me { $updata['bankname'] = $bankname; $updata['bankaccount'] = $bankaccount; $updata['uptimes'] = tostamp(); - $csql = new \ciy\sql('ap_usr_invoicetitle'); + $csql = new \ciy\sql('ap_invoicetitle'); if ($id > 0) { $csql->where('id', $id); if ($db->update($csql, $updata) === false) @@ -72,21 +613,97 @@ class me { $ret['data'] = $updata; return succjson($ret); } - public static function json_invoicetitle_del() { + public static function json_invoicetitle_list() { global $db; $rsuser = verifyfast(); - if ($rsuser === null) - return errjson('您还未登陆', 2); - $post = new \ciy\post(); - $id = $post->getint('id'); - $csql = new \ciy\sql('ap_usr_invoicetitle'); + $csql = new \ciy\sql('ap_invoicetitle'); $csql->where('vuser', $rsuser['id']); - $csql->where('id', $id); - if ($db->delete($csql) === false) - return errjson('删除失败:' . $db->error); + $csql->order('id desc'); + $ret['list'] = $db->get($csql); + return succjson($ret); + } + public static function json_invoice_lst_list() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $query = $post->get('query'); + $csql = new \ciy\sql('ap_invoicing'); + $csql->where('vuser', $rsuser['id']); + $liid = $post->getint('liid'); + if ($liid > 0) + $csql->where('auditstatus', $liid); + $csql->order(objstr($query, 'order', 'id desc')); + $pageno = $post->getint('pageno', 1); + $pagecount = $post->getint('pagecount', 10); + $csql->limit($pageno, $pagecount); + $rows = $db->get($csql); + $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); + $ret['ap_invoicedetail'] = getrelation($db, $rows, 'ap_invoicedetail', 'invoicedetailid'); + return succjson($ret); + } + public static function json_invoicing_submit() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $invoicetitleid = $post->getint('invoicetitleid'); + $invoicedetailid = $post->getint('invoicedetailid'); + $money = $post->getint('money'); + if ($money < 100) + return errjson('需填开票金额'); + if ($rsuser['myinvmoney'] < $money) + return errjson('可开票金额不足'); + $csql = new \ciy\sql('ap_invoicetitle'); + $csql->where('id', $invoicetitleid); + $invoicerow = $db->getone($csql); + if (!is_array($invoicerow)) + return errjson('开票抬头不存在'); + try { + $db->begin(); + $updata = array(); + $updata['myinvmoney'] = array('myinvmoney-' . $money); + $csql = new \ciy\sql('ap_user'); + $csql->where('id', $rsuser['id']); + if ($db->update($csql, $updata) === false) + throw new \Exception('更新账户失败:' . $db->error); + $updata = array(); + $updata['invoicemoney'] = $money; + $updata['invoicetitleid'] = $invoicetitleid; + $updata['invoicedetailid'] = $invoicedetailid; + $updata['vuser'] = $rsuser['id']; + $updata['addtimes'] = tostamp(); + $updata['auditstatus'] = 20; + $updata['name'] = $invoicerow['name']; + $updata['taxnumber'] = $invoicerow['taxnumber']; + $updata['addr'] = $invoicerow['addr']; + $updata['phone'] = $invoicerow['phone']; + $updata['bankname'] = $invoicerow['bankname']; + $updata['bankaccount'] = $invoicerow['bankaccount']; + $csql = new \ciy\sql('ap_invoicing'); + if ($db->insert($csql, $updata) === false) + throw new \Exception('创建失败:' . $db->error); + $db->commit(); + } catch (\Exception $ex) { + $db->rollback(); + return errjson($ex->getMessage()); + } return succjson(); } - public static function json_shipaddr_get() { + public static function json_invoicing_init() { + global $db; + $rsuser = verifyfast(); + $csql = new \ciy\sql('ap_user'); + $csql->where('id', $rsuser['id']); + $csql->column('myinvmoney'); + $ret['user'] = $db->getone($csql); + $csql = new \ciy\sql('ap_invoicedetail'); + $csql->column('id,name'); + $ret['details'] = $db->get($csql); + $ret['tip'] = '[MD] +可联系客服签订相关合同。 +'; + return succjson($ret); + } + public static function json_user_shipaddr_list() { global $db; $rsuser = verifyfast(); $csql = new \ciy\sql('ap_usr_shipaddr'); @@ -95,7 +712,7 @@ class me { $ret['list'] = $db->get($csql); return succjson($ret); } - public static function json_shipaddr_edit() { + public static function json_user_shipaddr_edit() { global $db; $rsuser = verifyfast(); if ($rsuser === null) @@ -142,7 +759,7 @@ class me { $ret['data'] = $updata; return succjson($ret); } - public static function json_shipaddr_del() { + public static function json_user_shipaddr_del() { global $db; $rsuser = verifyfast(); if ($rsuser === null) @@ -156,149 +773,7 @@ class me { return errjson('删除失败:' . $db->error); return succjson(); } - public static function json_problechat_close() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $id = $post->getint('id'); - $updata = array(); - $updata['closetimes'] = tostamp(); - $csql = new \ciy\sql('ap_usr_problem'); - $csql->where('id', $id); - if ($db->update($csql, $updata) === false) - return errjson('更新失败:' . $db->error); - return succjson(); - } - public static function json_problechat_send() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $content = $post->get('content'); - $id = $post->getint('id'); - $updata = array(); - $updata['problemid'] = $id; - $updata['content'] = $content; - $updata['sendtype'] = 1; - $updata['addtimes'] = tostamp(); - $csql = new \ciy\sql('ap_usr_problechat'); - if ($db->insert($csql, $updata) === false) - return errjson('更新失败:' . $db->error); - $updata['id'] = $db->insert_id(); - $ret['data'] = $updata; - $updata = array(); - $updata['replytimes'] = 0; - $updata['closetimes'] = 0; - $csql = new \ciy\sql('ap_usr_problem'); - $csql->where('id', $id); - if ($db->update($csql, $updata) === false) - return errjson('更新失败:' . $db->error); - return succjson($ret); - } - public static function json_problechat_get() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $id = $post->getint('id'); - $csql = new \ciy\sql('ap_usr_problechat'); - $csql->where('problemid', $id); - $mid = $post->getint('mid'); - $pagecount = $post->getint('pagecount', 20); - if ($post->get('op') == 'max') { - $csql->where('id>', $mid); - $csql->order('id'); - } else { - $csql->where('id<', $mid); - $csql->order('id desc'); - $csql->limit(1, $pagecount); - } - $rows = $db->get($csql); - $ret['list'] = $rows; - $ret['pagecount'] = $pagecount; - if ($post->getbool('once')) { - $ret['once'] = array(); - $csql = new \ciy\sql('ap_usr_problem'); - $csql->where('id', $id); - $ret['once']['data'] = $db->getone($csql); - } - return succjson($ret); - } - public static function json_problem_get() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $query = $post->get('query'); - $csql = new \ciy\sql('ap_usr_problem'); - $liid = objint($query, 'liid'); - if ($liid == 3) - $csql->where('closetimes=0')->where('replytimes>0'); - else if ($liid == 9) - $csql->where('closetimes>0'); - else - $csql->where('closetimes=0')->where('replytimes=0'); - $csql->where('vuser', $rsuser['id']); - $csql->order('id desc'); - $pageno = $post->getint('pageno', 1); - $pagecount = $post->getint('pagecount', 10); - $csql->limit($pageno, $pagecount); - $rows = $db->get($csql); - $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); - return succjson($ret); - } - public static function json_problem_add() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $content = $post->get('content'); - $imgs = $post->get('imgs'); - $contract = $post->get('contract'); - $updata = array(); - $updata['content'] = $content; - $updata['imgs'] = $imgs; - $updata['contract'] = $contract; - $updata['vuser'] = $rsuser['id']; - $updata['addtimes'] = tostamp(); - $csql = new \ciy\sql('ap_usr_problem'); - if ($db->insert($csql, $updata) === false) - return errjson('更新失败:' . $db->error); - $updata['id'] = $db->insert_id(); - $ret['data'] = $updata; - return succjson($ret); - } - public static function json_suggest_get() { - global $db; - $rsuser = verifyuser(); - $ret['list'] = array(); - if ($rsuser == null) - return succjson($ret); - $csql = new \ciy\sql('ap_usr_suggest'); - $csql->where('vuser', $rsuser['id']); - $csql->order('id desc'); - $csql->limit(1, 10); - $ret['list'] = $db->get($csql); - return succjson($ret); - } - public static function json_suggest_submit() { - global $db; - $rsuser = verifyuser(); - $post = new \ciy\post(); - $content = $post->get('content'); - $imgs = $post->get('imgs'); - $contract = $post->get('contract'); - $updata = array(); - $updata['content'] = $content; - $updata['imgs'] = $imgs; - $updata['contract'] = $contract; - if ($rsuser === null) - $updata['vuser'] = 0; - else - $updata['vuser'] = $rsuser['id']; - $updata['addtimes'] = tostamp(); - $csql = new \ciy\sql('ap_usr_suggest'); - if ($db->insert($csql, $updata) === false) - return errjson('更新失败:' . $db->error); - return succjson(); - } - public static function json_getqrcode() { + public static function json_share_qrcode_get() { global $db; $rsuser = verifyfast(); $filename = '/xcxqrcode/' . $rsuser['id'] . '.jpg'; @@ -336,322 +811,9 @@ class me { fclose($fp); return succjson($ret); } - public static function json_userreal_apply_get() { + public static function json_safe_password_change() { global $db; - $rsuser = verifyfast(); - $csql = new \ciy\sql('ap_usr_real_apply'); - $csql->where('vuser', $rsuser['id']); - $csql->order('id desc'); - $ret['data'] = $db->getone($csql); - return succjson($ret); - } - public static function json_userreal_apply_submit() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $name = $post->get('name'); - if (empty($name)) - return errjson('姓名不能为空.'); - $idid = idcard($post->get('idno')); - if (is_string($idid)) - return errjson($idid); - $idcard1 = $post->get('idcard1'); - $updata = array(); - $updata['auditstatus'] = 20; - $updata['vuser'] = $rsuser['id']; - $updata['name'] = $name; - $updata['idid'] = $idid['code']; - $updata['idcard1'] = $idcard1; - $updata['addtimes'] = tostamp(); - $csql = new \ciy\sql('ap_usr_real_apply'); - if ($db->insert($csql, $updata) === false) - return errjson('新增失败:' . $db->error); - return succjson(); - } - public static function json_wxrecvpay() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $id = $post->getint('id'); - $csql = new \ciy\sql('ap_cash_out'); - $csql->where('id', $id); - $cashrow = $db->getone($csql); - if (!is_array($cashrow)) - return errjson('提现不存在'); - if ($cashrow['cashstatus'] == 21) { - if ($cashrow['cashtimes'] > tostamp() - 86400) - return errjson('提现打款进程被打断。24小时后重新操作,请务必点击收款'); - } else if ($cashrow['cashstatus'] != 20) - return errjson('提现不是已通过状态'); - if ($cashrow['vuser'] != $rsuser['id']) - return errjson('提现用户不匹配'); - $updata = array(); - $updata['cashstatus'] = 21; - $updata['cashtimes'] = tostamp(); - $csql = new \ciy\sql('ap_cash_out'); - $csql->where('id', $id); - if ($db->update($csql, $updata) === false) - return errjson('更新失败'); - - $param = array(); - $param['out_bill_no'] = 'TB' . date('ymd') . '8' . $id; - $param['transfer_scene_id'] = '1005'; - $param['openid'] = $rsuser['wxminaid']; - $param['notify_url'] = 'https://ciyon.ciy.cn/ajax/ambap/wxpay.transfer'; - $param['transfer_remark'] = '佣金奖励'; - $param['transfer_amount'] = $cashrow['cashmoney']; - $param['transfer_scene_report_infos'] = array(); - $param['transfer_scene_report_infos'][] = array('info_type' => '岗位类型', 'info_content' => '采集员'); - $param['transfer_scene_report_infos'][] = array('info_type' => '报酬说明', 'info_content' => '用户主动申请提现'); - - $wxcfg = gettoken($db, 1); - $wxpay = new \ciy\wxfunc($wxcfg); - $rettransfer = $wxpay->transfer($param); - if (is_string($rettransfer)) - return errjson($rettransfer); - $rettransfer['mchid'] = $wxpay->mchid; - $rettransfer['appid'] = $wxpay->appid; - $ret['transfer'] = $rettransfer; - return succjson($ret); - } - public static function json_userbank_change() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $cashtype = $post->getint('cashtype'); - $bankno = $post->get('bankno'); - $bankname = $post->get('bankname'); - $bankaccount = $post->get('bankaccount'); - $updata = array(); - $updata['cashtype'] = $cashtype; - $updata['bankno'] = $bankno; - $updata['bankname'] = $bankname; - $updata['bankaccount'] = $bankaccount; - $csql = new \ciy\sql('ap_usr_ext'); - $csql->where('id', $rsuser['id']); - $extrow = $db->getone($csql); - if (is_array($extrow)) - if ($db->update($csql, $updata) === false) - return errjson('更新失败:' . $db->error); - else { - $updata['id'] = $rsuser['id']; - if ($db->insert($csql, $updata) === false) - return errjson('新增失败:' . $db->error); - } - return succjson(); - } - public static function json_cashout_get() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $query = $post->get('query'); - $csql = new \ciy\sql('ap_cash_out'); - $csql->where('vuser', $rsuser['id']); - $liid = objint($query, 'liid'); - if ($liid > 0) - $csql->where('cashstatus', $liid); - $csql->order(objstr($query, 'order', 'id desc')); - $pageno = $post->getint('pageno', 1); - $pagecount = $post->getint('pagecount', 10); - $csql->limit($pageno, $pagecount); - $rows = $db->get($csql); - $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); - return succjson($ret); - } - public static function json_invoicing_get() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $query = $post->get('query'); - $csql = new \ciy\sql('ap_usr_invoicing'); - $csql->where('vuser', $rsuser['id']); - $liid = objint($query, 'liid'); - if ($liid == 2) - $csql->where('invtimes=0'); - if ($liid == 3) - $csql->where('invtimes>0'); - $csql->order(objstr($query, 'order', 'id desc')); - $pageno = $post->getint('pageno', 1); - $pagecount = $post->getint('pagecount', 10); - $csql->limit($pageno, $pagecount); - $rows = $db->get($csql); - $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); - return succjson($ret); - } - public static function json_invoicing() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $invtit = $post->getint('invtit'); - $money = $post->getint('money'); - if ($money < 100) - return errjson('需填开票金额'); - if ($rsuser['myinvmoney'] < $money) - return errjson('可开票金额不足'); - $csql = new \ciy\sql('ap_usr_invoicetitle'); - $csql->where('id', $invtit); - $invoicerow = $db->getone($csql); - if (!is_array($invoicerow)) - return errjson('开票抬头不存在'); - try { - $db->begin(); - $updata = array(); - $updata['myinvmoney'] = array('myinvmoney-' . $money); - $csql = new \ciy\sql('ap_user'); - $csql->where('id', $rsuser['id']); - if ($db->update($csql, $updata) === false) - throw new \Exception('更新账户失败:' . $db->error); - $updata = array(); - $updata['invoicemoney'] = $money; - $updata['invoicetitleid'] = $invtit; - $updata['vuser'] = $rsuser['id']; - $updata['addtimes'] = tostamp(); - $updata['name'] = $invoicerow['name']; - $updata['taxnumber'] = $invoicerow['taxnumber']; - $updata['addr'] = $invoicerow['addr']; - $updata['phone'] = $invoicerow['phone']; - $updata['bankname'] = $invoicerow['bankname']; - $updata['bankaccount'] = $invoicerow['bankaccount']; - $csql = new \ciy\sql('ap_usr_invoicing'); - if ($db->insert($csql, $updata) === false) - throw new \Exception('创建失败:' . $db->error); - $db->commit(); - } catch (\Exception $ex) { - $db->rollback(); - return errjson($ex->getMessage()); - } - return succjson(); - } - public static function json_cash() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $cash = $post->getint('cash') * 100; - if ($rsuser['mycashmoney'] < $cash) - return errjson('余额不足'); - if ($rsuser['mybondmoney'] > 0) { - if ($rsuser['mycashmoney'] - $rsuser['mybondmoney'] < $cash) - return errjson('余额不足,保证金不能直接提现,请先退保证金'); - } - $cashtype = 1; - $csql = new \ciy\sql('ap_usr_ext'); - $csql->where('id', $rsuser['id']); - $extrow = $db->getone($csql); - if (is_array($extrow)) - $cashtype = $extrow['cashtype']; - if ($cashtype == 1) { - if ($cash < 1000 * 100) - return errjson('独立纳税,单次提现金额不能少于1000元'); - } - try { - $db->begin(); - $updata = array(); - $updata['mycashmoney'] = array('mycashmoney-' . $cash); - $csql = new \ciy\sql('ap_user'); - $csql->where('id', $rsuser['id']); - if ($db->update($csql, $updata) === false) - throw new \Exception('更新账户失败:' . $db->error); - $updata = array(); - $updata['cashstatus'] = 10; - $updata['cashmoney'] = $cash; - $updata['cashtype'] = $cashtype; - $updata['vuser'] = $rsuser['id']; - $updata['addtimes'] = tostamp(); - $csql = new \ciy\sql('ap_cash_out'); - if ($db->insert($csql, $updata) === false) - throw new \Exception('创建失败:' . $db->error); - $db->commit(); - } catch (\Exception $ex) { - $db->rollback(); - return errjson($ex->getMessage()); - } - return succjson(); - } - public static function json_pntbuy_get() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $query = $post->get('query'); - $csql = new \ciy\sql('ap_pnt_buy'); - $csql->where('vuser', $rsuser['id']); - $liid = objint($query, 'liid'); - if ($liid == 2) - $csql->where('paytimes=0'); - if ($liid == 3) - $csql->where('paytimes>0'); - $csql->order(objstr($query, 'order', 'id desc')); - $pageno = $post->getint('pageno', 1); - $pagecount = $post->getint('pagecount', 10); - $csql->limit($pageno, $pagecount); - $rows = $db->get($csql); - $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); - return succjson($ret); - } - public static function json_buy_paychk() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $id = $post->getint('orderid'); - for ($i = 0; $i < 10; $i++) { - $csql = new \ciy\sql('ap_pnt_buy'); - $csql->where('id', $id); - $buyrow = $db->getone($csql); - if (!is_array($buyrow)) - return errjson('订单不存在'); - if ($buyrow['paytimes'] > 0) - return succjson(); - sleep(1); - } - return errjson('支付不成功,请联系客服'); - } - - public static function json_buy_paynow() { - global $db; - $rsuser = verifyfast(); - //建立订单,支付 - $post = new \ciy\post(); - $id = $post->getint('id'); - $csql = new \ciy\sql('ap_pnt_bundle'); - $csql->where('id', $id); - $bundlerow = $db->getone($csql); - if (!is_array($bundlerow)) - return errjson('购买项目不存在'); - $payprice = $bundlerow['buymoney']; - $updata = array(); - $updata['pnt'] = $bundlerow['buypnt']; - $updata['buypntmoney'] = $payprice; - $updata['vuser'] = $rsuser['id']; - $updata['addtimes'] = tostamp(); - - $csql = new \ciy\sql('ap_pnt_buy'); - if ($db->insert($csql, $updata) === false) - return errjson('订单创建失败:' . $db->error); - $orderid = $db->insert_id(); - $param = array(); - $param['description'] = '购买金币'; - $param['out_trade_no'] = 'PT' . date('ymd') . '9' . $orderid; - $param['notify_url'] = 'https://ciyon.ciy.cn/ajax/ambap/wxpay.pay_pnt'; - $param['amount'] = array(); - $param['amount']['total'] = toint($payprice); - $param['payer'] = array(); - $param['payer']['openid'] = $rsuser['wxminaid']; - $wxcfg = gettoken($db, 1); - $wxpay = new \ciy\wxfunc($wxcfg); - $retpay = $wxpay->pay($param); - if (is_string($retpay)) - return errjson($retpay); - $retpay['orderid'] = $orderid; - return succjson($retpay); - } - public static function json_buy_init() { - global $db; - $csql = new \ciy\sql('ap_pnt_bundle'); - $ret['buys'] = $db->get($csql); - return succjson($ret); - } - public static function json_pass_change() { - global $db; - global $tokensalt; + global $_token; $rsuser = verifyfast(); $post = new \ciy\post(); $oldpass = $post->get('oldpass'); @@ -659,17 +821,160 @@ class me { $csql = new \ciy\sql('ap_user'); $csql->where('id', $rsuser['id']); $rsuser = $db->getone($csql); - if (!empty($rsuser['password']) && $rsuser['password'] != md5($oldpass . $tokensalt)) + if (!empty($rsuser['password']) && $rsuser['password'] != md5($oldpass . $_token['salt'])) return errjson('旧密码错误.'); $updata = array(); - $updata['password'] = md5($newpass . $tokensalt); + $updata['password'] = md5($newpass . $_token['salt']); $csql = new \ciy\sql('ap_user'); $csql->where('id', $rsuser['id']); if ($db->update($csql, $updata) === false) return errjson('密码更新失败:' . $db->error); return succjson(); } - public static function json_buy_userchk() { + public static function json_suggest_get() { + global $db; + $rsuser = verifyuser(); + $ret['list'] = array(); + if ($rsuser == null) + return succjson($ret); + $csql = new \ciy\sql('ap_usr_suggest'); + $csql->where('vuser', $rsuser['id']); + $csql->order('id desc'); + $csql->limit(1, 10); + $ret['list'] = $db->get($csql); + return succjson($ret); + } + public static function json_suggest_submit() { + global $db; + $rsuser = verifyuser(); + $post = new \ciy\post(); + $content = $post->get('content'); + $imgs = $post->get('imgs'); + $contract = $post->get('contract'); + $updata = array(); + $updata['content'] = $content; + $updata['imgs'] = $imgs; + $updata['contract'] = $contract; + if ($rsuser === null) + $updata['vuser'] = 0; + else + $updata['vuser'] = $rsuser['id']; + $updata['addtimes'] = tostamp(); + $csql = new \ciy\sql('ap_usr_suggest'); + if ($db->insert($csql, $updata) === false) + return errjson('更新失败:' . $db->error); + $updata['id'] = $db->insert_id(); + $ret['data'] = $updata; + return succjson($ret); + } + public static function json_problem_chat_send() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $content = $post->get('content'); + $id = $post->getint('id'); + $updata = array(); + $updata['problemid'] = $id; + $updata['content'] = $content; + $updata['sendtype'] = 1; + $updata['addtimes'] = tostamp(); + $csql = new \ciy\sql('ap_usr_problechat'); + if ($db->insert($csql, $updata) === false) + return errjson('更新失败:' . $db->error); + $updata['id'] = $db->insert_id(); + $ret['data'] = $updata; + $updata = array(); + $updata['replytimes'] = 0; + $updata['closetimes'] = 0; + $csql = new \ciy\sql('ap_usr_problem'); + $csql->where('id', $id); + if ($db->update($csql, $updata) === false) + return errjson('更新失败:' . $db->error); + return succjson($ret); + } + public static function json_problem_chat_get() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $id = $post->getint('id'); + $csql = new \ciy\sql('ap_usr_problechat'); + $csql->where('problemid', $id); + $mid = $post->getint('mid'); + $pagecount = $post->getint('pagecount', 20); + if ($post->get('op') == 'max') { + $csql->where('id>', $mid); + $csql->order('id'); + } else { + $csql->where('id<', $mid); + $csql->order('id desc'); + $csql->limit(1, $pagecount); + } + $rows = $db->get($csql); + $ret['list'] = $rows; + $ret['pagecount'] = $pagecount; + if ($post->getbool('once')) { + $ret['once'] = true; + $csql = new \ciy\sql('ap_usr_problem'); + $csql->where('id', $id); + $ret['problem'] = $db->getone($csql); + } + return succjson($ret); + } + public static function json_problem_pub_close() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $id = $post->getint('id'); + $updata = array(); + $updata['closetimes'] = tostamp(); + $csql = new \ciy\sql('ap_usr_problem'); + $csql->where('id', $id); + if ($db->update($csql, $updata) === false) + return errjson('更新失败:' . $db->error); + return succjson(); + } + public static function json_problem_pub_add() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $content = $post->get('content'); + $imgs = $post->get('imgs'); + $contract = $post->get('contract'); + $updata = array(); + $updata['content'] = $content; + $updata['imgs'] = $imgs; + $updata['contract'] = $contract; + $updata['vuser'] = $rsuser['id']; + $updata['addtimes'] = tostamp(); + $csql = new \ciy\sql('ap_usr_problem'); + if ($db->insert($csql, $updata) === false) + return errjson('更新失败:' . $db->error); + $updata['id'] = $db->insert_id(); + $ret['data'] = $updata; + return succjson($ret); + } + public static function json_problem_pub_list() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $csql = new \ciy\sql('ap_usr_problem'); + $liid = $post->getint('liid'); + if ($liid == 3) + $csql->where('closetimes=0')->where('replytimes>0'); + else if ($liid == 9) + $csql->where('closetimes>0'); + else + $csql->where('closetimes=0')->where('replytimes=0'); + $csql->where('vuser', $rsuser['id']); + $csql->order('id desc'); + $pageno = $post->getint('pageno', 1); + $pagecount = $post->getint('pagecount', 10); + $csql->limit($pageno, $pagecount); + $rows = $db->get($csql); + $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); + return succjson($ret); + } + public static function json_me_userbuy_chk() { global $db; $rsuser = verifyfast(); $post = new \ciy\post(); @@ -693,8 +998,9 @@ class me { return errjson('支付信息未同步,请下拉刷新'); } - public static function json_buy_usernow() { + public static function json_me_userbuy_create() { global $db; + global $_token; $rsuser = verifyfast(); $post = new \ciy\post(); $id = $post->getint('id'); @@ -718,230 +1024,31 @@ class me { $param = array(); $param['description'] = '购买会员'; $param['out_trade_no'] = 'UB' . date('ymd') . '9' . $orderid; - $param['notify_url'] = 'https://ciyon.ciy.cn/ajax/ambap/wxpay.pay_user'; + $param['notify_url'] = $_token['maindomain'] . 'wxpay.pay_user'; $param['amount'] = array(); - $param['amount']['total'] = toint($money); + $param['amount']['total'] = (int)$money; $param['payer'] = array(); $param['payer']['openid'] = $rsuser['wxminaid']; $wxcfg = gettoken($db, 1); $wxpay = new \ciy\wxfunc($wxcfg); - $retpay = $wxpay->pay($param); - if (is_string($retpay)) - return errjson($retpay); - $retpay['orderid'] = $orderid; - return succjson($retpay); - } - public static function json_usrbuy_get() { - global $db; - $csql = new \ciy\sql('ap_usr_buy_bundle'); - $ret['userbuys'] = $db->get($csql); - $ret['recommend'] = 2; + $ret = $wxpay->pay($param); + if (is_string($ret)) + return errjson($ret); + $ret['orderid'] = $orderid; return succjson($ret); } - public static function json_me_bank_info_change() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $bankno = $post->get('bankno'); - $bankname = $post->get('bankname'); - $bankaccount = $post->get('bankaccount'); - $bankcode = $post->get('bankcode'); - $updata = array(); - $updata['bankno'] = $bankno; - $updata['bankname'] = $bankname; - $updata['bankaccount'] = $bankaccount; - $updata['bankcode'] = $bankcode; - $csql = new \ciy\sql('ap_usr_ext'); - $csql->where('id', $rsuser['id']); - $extrow = $db->getone($csql); - if (is_array($extrow)) { - if ($db->update($csql, $updata) === false) - return errjson('ext更新失败:' . $db->error); - } else { - $updata['id'] = $rsuser['id']; - if ($db->insert($csql, $updata) === false) - return errjson('ext新增失败:' . $db->error); - } - return succjson(); - } - public static function json_userinfo_change() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $name = $post->get('name'); - $icon = $post->get('icon'); - $mobile = $post->get('mobile'); - $wxno = $post->get('wxno'); - $email = $post->get('email'); - $updata = array(); - $updata['name'] = $name; - $updata['icon'] = $icon; - $updata['mobile'] = $mobile; - $csql = new \ciy\sql('ap_user'); - $csql->where('id', $rsuser['id']); - if ($db->update($csql, $updata) === false) - return errjson('更新失败:' . $db->error); - $updata = array(); - $updata['wxno'] = $wxno; - $updata['email'] = $email; - $csql = new \ciy\sql('ap_usr_ext'); - $csql->where('id', $rsuser['id']); - $extrow = $db->getone($csql); - if (is_array($extrow)) { - if ($db->update($csql, $updata) === false) - return errjson('ext更新失败:' . $db->error); - } else { - $updata['id'] = $rsuser['id']; - if ($db->insert($csql, $updata) === false) - return errjson('ext新增失败:' . $db->error); - } - return succjson(); - } - public static function json_balance_get() { + public static function json_me_balance_get() { global $db; $rsuser = verifyfast(); $csql = new \ciy\sql('ap_user'); $csql->where('id', $rsuser['id']); - $csql->column('myinvmoney,mycashmoney,mybondmoney,mypnt'); $ret['user'] = $db->getone($csql); - return succjson($ret); - } - public static function json_cash_get() { - global $db; - $rsuser = verifyfast(); - $csql = new \ciy\sql('ap_user'); - $csql->where('id', $rsuser['id']); - $csql->column('myinvmoney,mycashmoney,mybondmoney,mypnt'); - $ret['user'] = $db->getone($csql); - $csql = new \ciy\sql('ap_cash_out'); - $csql->where('vuser', $rsuser['id']); - $csql->where('cashstatus', 20); - $ret['cash'] = $db->get($csql); - return succjson($ret); - } - public static function json_charge_paychk() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $id = $post->getint('orderid'); - for ($i = 0; $i < 10; $i++) { - $csql = new \ciy\sql('ap_cash_in'); - $csql->where('id', $id); - $buyrow = $db->getone($csql); - if (!is_array($buyrow)) - return errjson('订单不存在'); - if ($buyrow['paytimes'] > 0) - return succjson(); - sleep(1); - } - return errjson('充值不成功,请联系客服'); - } - public static function json_charge_paynow() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $money = $post->getint('money'); - $updata = array(); - $updata['name'] = ''; - $updata['inmoney'] = $money; - $updata['vuser'] = $rsuser['id']; - $updata['addtimes'] = tostamp(); - $updata['paytimes'] = 0; - $csql = new \ciy\sql('ap_cash_in'); - if ($db->insert($csql, $updata) === false) - return errjson('订单创建失败:' . $db->error); - $orderid = $db->insert_id(); - $param = array(); - $param['description'] = '充值'; - $param['out_trade_no'] = 'IN' . date('ymd') . '2' . $orderid; - $param['notify_url'] = 'https://ciyon.ciy.cn/ajax/ambap/wxpay.charge'; - $param['amount'] = array(); - $param['amount']['total'] = toint($money); - $param['payer'] = array(); - $param['payer']['openid'] = $rsuser['wxminaid']; - $wxcfg = gettoken($db, 1); - $wxpay = new \ciy\wxfunc($wxcfg); - $retpay = $wxpay->pay($param); - if (is_string($retpay)) - return errjson($retpay); - $retpay['orderid'] = $orderid; - return succjson($retpay); - } - public static function json_cashin_get() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $query = $post->get('query'); - $csql = new \ciy\sql('ap_cash_in'); - $csql->where('paytimes>0'); - $csql->where('vuser', $rsuser['id']); - $csql->order(objstr($query, 'order', 'id desc')); - $pageno = $post->getint('pageno', 1); - $pagecount = $post->getint('pagecount', 10); - $csql->limit($pageno, $pagecount); - $rows = $db->get($csql); - $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); - return succjson($ret); - } - public static function json_cashie_get() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $query = $post->get('query'); - $csql = new \ciy\sql('ap_cash_ie'); - $csql->where('vuser', $rsuser['id']); - $liid = objint($query, 'liid'); - if ($liid == 1) - $csql->where('iemoney>0'); - if ($liid == 2) - $csql->where('iemoney<0'); - $csql->order(objstr($query, 'order', 'id desc')); - $pageno = $post->getint('pageno', 1); - $pagecount = $post->getint('pagecount', 10); - $csql->limit($pageno, $pagecount); - $rows = $db->get($csql); - $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); - return succjson($ret); - } - public static function json_pntrecord_get() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $query = $post->get('query'); - $csql = new \ciy\sql('ap_pnt_record'); - $csql->where('vuser', $rsuser['id']); - $csql->order(objstr($query, 'order', 'id desc')); - $pageno = $post->getint('pageno', 1); - $pagecount = $post->getint('pagecount', 10); - $csql->limit($pageno, $pagecount); - $rows = $db->get($csql); - $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); - return succjson($ret); - } - public static function json_pnt_up() { - global $db; - $rsuser = verifyfast(); - $post = new \ciy\post(); - $id = $post->getint('id'); - $csql = new \ciy\sql('ap_pnt_track'); - $csql->where('id', $id); - $trackrow = $db->getone($csql); - if (!is_array($trackrow)) - return errjson('埋点不存在' . $id); - $point = $trackrow['point']; - $updata = array(); - $updata['vuser'] = $rsuser['id']; - $updata['fromid'] = $id; - $updata['name'] = $trackrow['name']; - $updata['pnt'] = $point; - $updata['addtimes'] = tostamp(); - $csql = new \ciy\sql('ap_pnt_record'); - $db->insert($csql, $updata); - $db->execute('update ap_user set mypnt=mypnt+' . $point . ' where id=' . $rsuser['id']); - $msg = ''; - if ($id == 1) - $msg = '已签到 +' . $point . ' 积分'; - $ret['msg'] = $msg; + unset($ret['user']['password']); + unset($ret['user']['sid']); + unset($ret['user']['wxminaid']); + unset($ret['user']['wxminakey']); + unset($ret['user']['wxunionid']); + unset($ret['user']['memo']); return succjson($ret); } } diff --git a/web/ambap/wxpay.php b/web/ambap/wxpay.php index 5e0b1b0..7e661bb 100644 --- a/web/ambap/wxpay.php +++ b/web/ambap/wxpay.php @@ -1,6 +1,6 @@ where('id', $userid); if ($db->update($csql, $updata) === false) @@ -100,9 +101,9 @@ class wxpay { if (@$json['state'] != 'SUCCESS') return self::errlog('付款失败:' . $dat); - $noid = toint(substr($json['out_bill_no'], 9)); + $noid = (int)substr($json['out_bill_no'], 9); - $csql = new \ciy\sql('ap_fina_cash'); + $csql = new \ciy\sql('ap_cash_out'); $csql->where('id', $noid); $orderrow = $db->getone($csql); if (!is_array($orderrow)) @@ -122,16 +123,15 @@ class wxpay { $updata['cashtimes'] = tostamp(); $updata['cashno'] = $json['transfer_bill_no']; $updata['cashstatus'] = 100; - $csql = new \ciy\sql('ap_fina_cash'); + $csql = new \ciy\sql('ap_cash_out'); $csql->where('id', $noid); if ($db->update($csql, $updata) === false) - throw new \Exception('更新ap_fina_cash失败:' . $db->error); + throw new \Exception('更新ap_cash_out失败:' . $db->error); //sendusermsg($db, $orderrow['userid'], '集市通知', '买家已付款,请及时处理', '/work/ec/order_detail?id=' . $noid); $db->commit(); } catch (\Exception $ex) { $db->rollback(); - savelogfile('err_db', $ex->getMessage()); return self::errlog($ex->getMessage(), $userid); } savelogfile('wxpay_pnt', '成功提现[' . $noid . ']'); @@ -164,7 +164,7 @@ class wxpay { return self::errlog('解析密文JSON出错:' . $dat); if (@$json['trade_state'] != 'SUCCESS') return self::errlog('支付失败:' . $dat); - $noid = toint(substr($json['out_trade_no'], 9)); + $noid = (int)substr($json['out_trade_no'], 9); $csql = new \ciy\sql('ap_pnt_buy'); $csql->where('id', $noid); @@ -172,7 +172,7 @@ class wxpay { if (!is_array($orderrow)) return self::errlog('订单不存在:' . $noid); $userid = $orderrow['vuser']; - $buypntmoney = toint($orderrow['buypntmoney']); + $buypntmoney = (int)$orderrow['buypntmoney']; if ($buypntmoney != $json['amount']['total']) return self::errlog('订单金额错误[' . $buypntmoney . '!=' . $json['amount']['total'] . ']:' . $noid, $userid); if ($orderrow['paytimes'] > 0) { @@ -183,6 +183,7 @@ class wxpay { try { $db->begin(); $updata = array(); + $updata['name'] = $json['transaction_id']; $updata['paytimes'] = tostamp(); $csql = new \ciy\sql('ap_pnt_buy'); $csql->where('id', $noid); @@ -190,9 +191,10 @@ class wxpay { throw new \Exception('更新ap_pnt_buy失败:' . $db->error); //sendusermsg($db, $orderrow['userid'], '集市通知', '买家已付款,请及时处理', '/work/ec/order_detail?id=' . $noid); - $pnt = toint($orderrow['pnt']); + $pnt = (int)$orderrow['pnt']; $updata = array(); $updata['mypnt'] = array('mypnt+' . $pnt); + $updata['myinvmoney'] = array('myinvmoney+' . $buypntmoney); $csql = new \ciy\sql('ap_user'); $csql->where('id', $userid); if ($db->update($csql, $updata) === false) @@ -268,6 +270,7 @@ class wxpay { $userrow['accounttimes'] = tostamp(); $updata = array(); $updata['userlevel'] = $orderrow['userlevel']; + $updata['myinvmoney'] = array('myinvmoney+' . $money); $updata['accounttimes'] = $userrow['accounttimes'] + $days * 86400; $csql = new \ciy\sql('ap_user'); $csql->where('id', $userid); diff --git a/web/jscss/ciy.js b/web/jscss/ciy.js index b20e2e4..edf0c89 100644 --- a/web/jscss/ciy.js +++ b/web/jscss/ciy.js @@ -821,8 +821,8 @@ ciyfn.split = function (str, sep) { arr[i] = arr[i].trim(); return arr; } -ciyfn.getdictdata = function (datakey, once, reldata) { - //直接数组(直传,once数据),字典缓存,静态引用,字符串拼接 +ciyfn.getdictdata = function (datakey, pagedata) { + //直接数组,字典缓存,静态引用,字符串拼接 if (isarray(datakey)) return datakey; if (typeof (datakey) != 'string') @@ -830,10 +830,8 @@ ciyfn.getdictdata = function (datakey, once, reldata) { var datas = ciyfn.getstorage('cata_' + datakey); if (isarray(datas)) return datas; - if (isobj(once) && once[datakey]) - return once[datakey]; - if (isobj(reldata) && reldata[datakey]) - return reldata[datakey]; + if (isobj(pagedata) && pagedata[datakey]) + return pagedata[datakey]; if (isarray(window[datakey])) return window[datakey]; if (datakey.indexOf(',') == -1 && datakey.indexOf(':') == -1) @@ -1071,7 +1069,7 @@ ciyfn.callfunc = function (funcname, post, successfunc, opn) { //opn showload,m } opn.data = post || {}; - opn.data._pf = 'PC'; + opn.data._pf = 'PC' + new Date().getTime() + '_' + parseInt(80000000 + Math.random() * 10000000); opn.done = function (xhr) { ciygv._clickduptime = null; if (ciygv._clickdupdombtn) { @@ -2306,7 +2304,7 @@ ciyfn.objdeepmerge = function (src, desc, btop) { src[key] = desc[key]; } } - if (!desc.errmsg && src.errmsg) + if (desc && !desc.errmsg && src.errmsg) delete src.errmsg; return src; } diff --git a/web/jscss/ciycmp.js b/web/jscss/ciycmp.js index b7ce456..0033e39 100644 --- a/web/jscss/ciycmp.js +++ b/web/jscss/ciycmp.js @@ -84,7 +84,7 @@ ciyfn.file_uploads = function (maxcount, files, opn, fn) { } var name = gfile.name; if (zipjpg > 0) { - var U = canvas.toDataURL("image/jpeg", zipjpg); + var U = canvas.toDataURL("image/jpeg", zipjpg/100); if (fext != 'JPG') name = gfile.name + '.jpg'; } @@ -1219,7 +1219,7 @@ ciycmpfunc.ciyupload = function (opn) { // v2 opn.imgwidth = toint(opn.imgwidth || opn.dom.attr('imgwidth')); opn.imgheight = toint(opn.imgheight || opn.dom.attr('imgheight')); opn.maxsize = toint(opn.maxsize || opn.dom.attr('maxsize')); - opn.zipjpg = tofloat(opn.zipjpg || opn.dom.attr('zipjpg')); + opn.zipjpg = toint(opn.zipjpg || opn.dom.attr('zipjpg')); opn.zipext = opn.zipext || opn.dom.attr('zipext') || 'jpg,png,webp'; if (opn.zipext) opn.zipext = opn.zipext.toUpperCase().split(','); diff --git a/web/jscss/ciycmp2.js b/web/jscss/ciycmp2.js index 65afbea..55810ea 100644 --- a/web/jscss/ciycmp2.js +++ b/web/jscss/ciycmp2.js @@ -752,7 +752,10 @@ ciycmpfunc.ciymap = function (opn) { var thos = this; this.onchange = opn.onchange; opn.initevent = opn.initevent || opn.dom.hasattr('initevent'); + opn.bet = toint(opn.bet || opn.dom.attr('bet') || 10000000); opn.mapkey = opn.mapkey || opn.dom.hasattr('mapkey'); + if(opn.bet < 1) + opn.bet = 1; var html = ''; html += ''; html += ''; @@ -763,15 +766,20 @@ ciycmpfunc.ciymap = function (opn) { var valuedom_lng = opn.dom.children(1); var showbtndom = opn.dom.children(2); var showspandom = opn.dom.children(3); + function caldectoint(dec) { + if(opn.bet <= 1) + return dec; + return toint(dec * opn.bet); + } this.setvalue = function (newvalue, from) { if (typeof (newvalue) == 'object') { - this.value.lat = tofloat(newvalue.lat); - this.value.lng = tofloat(newvalue.lng); + this.value.lat = newvalue.lat; + this.value.lng = newvalue.lng; } else if (newvalue !== undefined) { var ll = (newvalue + '').split(','); if (ll.length > 1) { - this.value.lat = tofloat(ll[0]); - this.value.lng = tofloat(ll[1]); + this.value.lat = ll[0]; + this.value.lng = ll[1]; } } valuedom_lat.val(this.value.lat); @@ -792,11 +800,11 @@ ciycmpfunc.ciymap = function (opn) { title: '选择地图位置' , width: 'max' , height: 'max' - , frame: '/jscss/map_loc.html?edit=true&addr=' + opn.mapkey + '&lat=' + thos.value.lat + "&lng=" + thos.value.lng + , frame: '/jscss/map_loc.html?edit=true&addr=' + opn.mapkey + '&lat=' + thos.value.lat / opn.bet + "&lng=" + thos.value.lng / opn.bet , cb: function (opnmap) { opnmap.close(); - thos.value.lat = opnmap.inputs.lat; - thos.value.lng = opnmap.inputs.lng; + thos.value.lat = caldectoint(opnmap.inputs.lat); + thos.value.lng = caldectoint(opnmap.inputs.lng); thos.setvalue(undefined, 'select'); } }); @@ -1041,8 +1049,7 @@ ciycmpfunc.ciymarkdown = function (opn) { else opn.width = '418px'; opn.maxsize = toint(opn.maxsize || opn.dom.attr('maxsize')); - opn.zipjpg = tofloat(opn.zipjpg || opn.dom.attr('zipjpg')); - opn.zipext = tofloat(opn.zipext || opn.dom.attr('zipext')); + opn.zipjpg = toint(opn.zipjpg || opn.dom.attr('zipjpg')); opn.waterfont = opn.waterfont || opn.dom.attr('waterfont') || '28px Arial'; opn.watertext = opn.watertext || opn.dom.attr('watertext') || ''; opn.fileext = (opn.fileext || opn.dom.attr('fileext') || '.pdf,.zip,.docx,.doc,.pptx,.ppt,.xlsx,.xls,.txt,.rar,.7z,.tar,.glb').toLowerCase().split(','); diff --git a/web/jscss/ciytable.js b/web/jscss/ciytable.js index 3bfba11..d9fabc4 100644 --- a/web/jscss/ciytable.js +++ b/web/jscss/ciytable.js @@ -44,7 +44,7 @@ ciyclass.cardtable = function (opn) { this.post.count = this.cachecount; ciyfn.callfunc(opn.url, this.post, function (json) { thos.post.once = false; - thos.json = json; + thos.json = ciyfn.objdeepmerge(thos.json, json); if (json.once) thos.once = json.once; if (typeof (opn.fn_beforedata) == 'function') @@ -200,7 +200,7 @@ ciyclass.table = function (opn) { thos.post.once = false; if (json.once) thos.once = json.once; - thos.json = json; + thos.json = ciyfn.objdeepmerge(thos.json, json); if (json.count > -1) thos.cachecount = json.count; else if (thos.cachecount > -1) @@ -439,8 +439,8 @@ ciyclass.table = function (opn) { } ciyfn._table_fillpage(_pagedom, json, opn.btncolumnset == 1); $5('th>i.sort', this.dom).removeClass('js').removeClass('db'); - if (json.where) { - $5('i[data-order="' + json.where.order + '"]', this.dom).addClass('sort').addClass('db'); + if (json.searchwhere) { + $5('i[data-order="' + json.searchwhere.order + '"]', this.dom).addClass('sort').addClass('db'); } dataready = false; pubhtml(html); @@ -483,7 +483,7 @@ ciyclass.table = function (opn) { if (dataori === undefined) dataori = ''; dataori = dataori + ''; - var datashow = ciyfn.tdshow(dataori, ftf.ext, ldat, this.once, this.json); + var datashow = ciyfn.tdshow(key, dataori, ftf.ext, ldat, this.json); var fdata = undefined; if (typeof (opn.fn_tdcontent) == 'function') fdata = opn.fn_tdcontent(key, datashow, ftf, ldat, this.json); @@ -760,7 +760,7 @@ ciyclass.table = function (opn) { if (json.total[key][0] == '_') html += json.total[key].substring(1); else - html += ciyfn.tdshow(json.total[key], field.ext, json.total, thos.once, json); + html += ciyfn.tdshow(key, json.total[key], field.ext, json.total, json); } html += '
'; }); @@ -774,21 +774,21 @@ ciyfn.fillsearch = function (opn) { opn.data = opn.data || {}; var urlp = ciyfn.urlparam(); opn.more = (opn.more === undefined ? true : opn.more); - if (isobj(opn.data.where)) { - for (var w in opn.data.where) { - if (!opn.data.where[w]) + if (isobj(opn.data.searchwhere)) { + for (var w in opn.data.searchwhere) { + if (!opn.data.searchwhere[w]) continue; if (w == 'liid') { $5('li[data-liid]', '.search').removeClass('active'); - $5('li[data-liid="' + opn.data.where[w] + '"]', '.search').addClass('active'); + $5('li[data-liid="' + opn.data.searchwhere[w] + '"]', '.search').addClass('active'); } else if (w) - $5('[sechr=' + w + ']', '.search').val(opn.data.where[w]); + $5('[sechr=' + w + ']', '.search').val(opn.data.searchwhere[w]); } } - if (!opn.data.once || !opn.data.once.input) + if (!opn.data.once || !opn.data.searchinput) return; if (opn.lidata) { - opn.lidata = ciyfn.filterdictdata(ciyfn.getdictdata(opn.lidata, opn.data.once), { + opn.lidata = ciyfn.filterdictdata(ciyfn.getdictdata(opn.lidata, opn.data), { limit: opn.lilimit , filter: opn.lifilter , rename: opn.lirename @@ -813,9 +813,9 @@ ciyfn.fillsearch = function (opn) { if (inpsdom.length == 0) return console.warn('search input not found'); inpsdom.children().remove(); - for (var idx in opn.data.once.input) { + for (var idx in opn.data.searchinput) { var html = ''; - var sp = opn.data.once.input[idx]; + var sp = opn.data.searchinput[idx]; var name = sp.form; if (sp.type == 'hidden') { html = ''; @@ -844,7 +844,7 @@ ciyfn.fillsearch = function (opn) { if (sp.type == 'radio') html += ''; sp.def = sp.def || ''; - seldata = ciyfn.filterdictdata(ciyfn.getdictdata(sp.select, opn.data.once), { + seldata = ciyfn.filterdictdata(ciyfn.getdictdata(sp.select, opn.data), { limit: sp.limit , first: sp.first , filter: sp.filter @@ -1003,7 +1003,7 @@ ciyfn._table_eventpage = function (_pagedom, thos) { var values = []; for (var i = 0; i < thdoms.length; i++) { var key = thdoms[i].getAttribute('data-field'); - if(key === null) + if (key === null) continue; range.push({ id: key, name: thdoms[i].textContent }); if (isarray(localset.thhide)) { @@ -1230,72 +1230,80 @@ ciyfn.table_exportxls = function (func, table, fn_success) { } }); } -ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { - function numunit(num, bet, pstr, defunit, data) { - var ind = pstr.indexOf(','); - if (ind > -1) { - defunit = pstr.substring(ind + 1); - pstr = pstr.substring(0, ind); - } - if (data && data[defunit]) - defunit = data[defunit]; - num = num / bet; - var unitarr = defunit.split('|'); - var u1 = toint(unitarr[1]); - var u2 = toint(unitarr[3]); - var unit = unitarr[0]; - if (u1 > 0 && u2 > 0) { - if (num >= u1 * u2) { - num = num / u1 / u2; - unit = unitarr[4]; - } else if (num >= u1) { - num = num / u1; - unit = unitarr[2]; - } - } else if (u1 > 0) { - if (num >= u1) { - num = num / u1; - unit = unitarr[2]; - } - } - var cns = (ciyfn.tofix(num, toint(pstr)) + '').split('.'); - var ret = cns[0].replace(/\d{1,3}(?=(\d{3})+$)/g, '$&,'); - if (cns.length > 1) - ret += '.' + cns[1] + ' '; - ret += ciyfn.lang(unit); - return ret; +ciyfn.tonumunit = function (num, bet, pstr, defunit, data) { + var ind = pstr.indexOf(','); + if (ind > -1) { + defunit = pstr.substring(ind + 1); + pstr = pstr.substring(0, ind); } - function numbet(num, fixlen, bet, unit) { - var unitarr = unit.split('.'); - var betarr = bet.split('.'); - num = toint(num); - var betidx = 0; - for (var i = betarr.length - 1; i >= 0; i--) { - if (num / betarr[i] >= 0.1) { - if (betarr[i] >= 1000 && num % parseInt(betarr[i] / 1000) == 0) { - betidx = i; - break; - } - } - if (num != 0 && num % betarr[i] == 0) { + if (data && data[defunit]) + defunit = data[defunit]; + num = num / bet; + var unitarr = defunit.split('|'); + var u1 = toint(unitarr[1]); + var u2 = toint(unitarr[3]); + var unit = unitarr[0]; + if (u1 > 0 && u2 > 0) { + if (num >= u1 * u2) { + num = num / u1 / u2; + unit = unitarr[4]; + } else if (num >= u1) { + num = num / u1; + unit = unitarr[2]; + } + } else if (u1 > 0) { + if (num >= u1) { + num = num / u1; + unit = unitarr[2]; + } + } + var cns = (ciyfn.tofix(num, toint(pstr)) + '').split('.'); + var ret = cns[0].replace(/\d{1,3}(?=(\d{3})+$)/g, '$&,'); + if (cns.length > 1) + ret += '.' + cns[1] + ' '; + ret += ciyfn.lang(unit); + return ret; +} +ciyfn.tonumbet = function (num, fixlen, bet, unit) { + var unitarr = unit.split('.'); + var betarr = bet.split('.'); + num = toint(num); + var betidx = 0; + for (var i = betarr.length - 1; i >= 0; i--) { + if (num / betarr[i] >= 0.1) { + if (betarr[i] >= 1000 && num % parseInt(betarr[i] / 1000) == 0) { betidx = i; break; } } - num = num / betarr[betidx]; - var cns = (ciyfn.tofix(num, toint(fixlen)) + '').split('.'); - var ret = cns[0].replace(/\d{1,3}(?=(\d{3})+$)/g, '$&,'); - if (cns.length > 1) - ret += '.' + cns[1] + ' '; - var unit = unitarr[betidx]; - if (unit.substring(0, 1) == '*') - unit = unit.substring(1); - ret += ciyfn.lang(unit); - return ret; + if (num != 0 && num % betarr[i] == 0) { + betidx = i; + break; + } } + num = num / betarr[betidx]; + var cns = (ciyfn.tofix(num, toint(fixlen)) + '').split('.'); + var ret = cns[0].replace(/\d{1,3}(?=(\d{3})+$)/g, '$&,'); + if (cns.length > 1) + ret += '.' + cns[1] + ' '; + var unit = unitarr[betidx]; + if (unit.substring(0, 1) == '*') + unit = unit.substring(1); + ret += ciyfn.lang(unit); + return ret; +} +ciyfn.tdshow = function (fieldname, dataori, ext, linedata, json, isview) { if (!ext) return dataori; var datashow = ''; + var preext = ext.substring(0, 6); + if (preext == 'FILEMD') { + if (dataori == 0) + return '--'; + if (!isview) + return 'V' + dataori; + return '
'; + } var preext = ext.substring(0, 5); if (preext == 'FSIZE') { var pint = toint(ext.substring(6)); @@ -1312,13 +1320,14 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { if (preext == 'METRE') { if (dataori == 0) return '--'; - return numunit(dataori, 1000, ext.substring(6), '米|1000|公里'); + return ciyfn.tonumunit(dataori, 1000, ext.substring(6), '米|1000|公里'); } preext = ext.substring(0, 4); if (preext == 'DATE') { if (dataori == 0) return '--'; - return ciyfn.todatetime(dataori, ext.substring(5)); + var pstr = ext.substring(5); + return ciyfn.todatetime(dataori, pstr); } if (preext == 'TIME') { if (dataori == 0) @@ -1329,7 +1338,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { if (dataori == 0) return '--'; var pstr = ext.substring(4) || '4'; - return numunit(dataori, 10000, pstr, '|1000000|万'); + return ciyfn.tonumunit(dataori, 10000, pstr, '|1000000|万'); } if (preext == 'WCNY') { if (dataori == 0) @@ -1337,7 +1346,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { var pstrs = ext.substring(5).split(','); if (!pstrs[1]) pstrs[1] = '元'; - return numunit(dataori, 1000000, pstrs[0], '万' + pstrs[1] + '|10000|亿' + pstrs[1]); + return ciyfn.tonumunit(dataori, 1000000, pstrs[0], '万' + pstrs[1] + '|10000|亿' + pstrs[1]); } if (preext == 'DOWN') { if (!dataori) @@ -1407,7 +1416,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { } if (preext == 'CATA' || preext == 'CATU') { var pstr = ext.substring(5); - var catas = ciyfn.getdictdata(pstr, once, json); + var catas = ciyfn.getdictdata(pstr, json); if (dataori == 0) return '--'; if (!isarray(catas)) @@ -1436,7 +1445,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { } if (dataori == '') return '--'; - var catas = ciyfn.getdictdata(pstr, once, json); + var catas = ciyfn.getdictdata(pstr, json); if (!isarray(catas)) return dataori + "!"; var vals = dataori.split(','); @@ -1466,7 +1475,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { } if (dataori == '') return '--'; - var catas = ciyfn.getdictdata(pstr, once, json); + var catas = ciyfn.getdictdata(pstr, json); if (!isarray(catas)) return dataori + "!"; var mdatas = ciyfn.mcode(catas, dataori); @@ -1491,7 +1500,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { } if (dataori == '') return '--'; - var catas = ciyfn.getdictdata(pstr, once, json); + var catas = ciyfn.getdictdata(pstr, json); if (!isarray(catas)) return dataori + "!"; var pstrs = {}; @@ -1508,7 +1517,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { } if (preext == 'TINT') { var pstr = ext.substring(5); - var catas = ciyfn.getdictdata(pstr, once, json); + var catas = ciyfn.getdictdata(pstr, json); if (dataori == 0) return '--'; if (!isarray(catas)) @@ -1529,7 +1538,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { var pstrs = ext.substring(4).split(','); pstrs[0] = pstrs[0] || '元.万元.亿元'; pstrs[1] = pstrs[1] || '2'; - return numbet(dataori, pstrs[1], '100.1000000.10000000000', pstrs[0]); + return ciyfn.tonumbet(dataori, pstrs[1], '100.1000000.10000000000', pstrs[0]); } if (preext == 'SNY') { if (dataori == 0) @@ -1537,7 +1546,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { var pstrs = ext.substring(4).split(','); pstrs[0] = pstrs[0] || '.K.M.B.T.Q'; pstrs[1] = pstrs[1] || '2'; - return numbet(dataori, pstrs[1], '100.100000.100000000.100000000000.100000000000000', pstrs[0]); + return ciyfn.tonumbet(dataori, pstrs[1], '100.100000.100000000.100000000000.100000000000000', pstrs[0]); } if (preext == 'WGT') { if (dataori == 0) @@ -1545,7 +1554,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { var pstrs = ext.substring(4).split(','); pstrs[0] = pstrs[0] || '克.千克.吨'; pstrs[1] = pstrs[1] || '2'; - return numbet(dataori, pstrs[1], '1.1000.1000000', pstrs[0]); + return ciyfn.tonumbet(dataori, pstrs[1], '1.1000.1000000', pstrs[0]); } if (preext == 'LGH') { if (dataori == 0) @@ -1553,7 +1562,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { var pstrs = ext.substring(4).split(','); pstrs[0] = pstrs[0] || '厘米.米.公里'; pstrs[1] = pstrs[1] || '2'; - return numbet(dataori, pstrs[1], '10.1000.1000000', pstrs[0]); + return ciyfn.tonumbet(dataori, pstrs[1], '10.1000.1000000', pstrs[0]); } if (preext == 'BET') { if (dataori == 0) @@ -1561,7 +1570,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { var pstrs = ext.substring(4).split(','); pstrs[1] = pstrs[1] || '100'; pstrs[2] = pstrs[2] || '2'; - return numbet(dataori, pstrs[2], pstrs[1], pstrs[0]); + return ciyfn.tonumbet(dataori, pstrs[2], pstrs[1], pstrs[0]); } if (preext == 'CYC') { if (dataori == 0) @@ -1634,13 +1643,13 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { if (preext == 'TON') { if (dataori == 0) return '--'; - return numunit(dataori, 1000000, ext.substring(4), '吨|10000|万吨'); + return ciyfn.tonumunit(dataori, 1000000, ext.substring(4), '吨|10000|万吨'); } if (preext == 'PCT') { if (dataori == 0) return '--'; var pstr = ext.substring(4) || '2'; - return numunit(dataori, 100, pstr, '%'); + return ciyfn.tonumunit(dataori, 100, pstr, '%'); } if (preext == 'CNY') { if (dataori == 0) @@ -1649,23 +1658,27 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { pstrs[0] = pstrs[0] || '2'; if (!pstrs[1]) pstrs[1] = '元'; - return numunit(dataori, 100, pstrs[0], pstrs[1] + '|10000|万' + pstrs[1]); + return ciyfn.tonumunit(dataori, 100, pstrs[0], pstrs[1] + '|10000|万' + pstrs[1]); } if (preext == 'LOC') { var pstr = ext.substring(4); if (pstr.length == 0) pstr = 'lat'; + var pstrs = pstr.split(','); var lng = tofloat(dataori); - var lat = tofloat(linedata[pstr]); + var lat = tofloat(linedata[pstrs[0]]); + var bet = 10000000; + if (pstrs.length > 1) + bet = toint(pstrs[1]); if (ciyfn.isfloat0(lng) && ciyfn.isfloat0(lat)) return '--'; - return '' + ciyfn.lang('打开地图') + ''; + return '' + ciyfn.lang('打开地图') + ''; } if (preext == 'NUM') { //小数处理 -3 整数或保留3位小数 3只保留3位小数 空 整数 小数去掉.9999999和.0000001 var dnum = tofloat(dataori); if (Math.abs(dnum - Math.round(dnum)) < 0.00001) { dnum = Math.round(dnum); } - return numunit(dnum, 1, ext.substring(4), '', linedata); + return ciyfn.tonumunit(dnum, 1, ext.substring(4), '', linedata); } if (preext == 'URL') { var pstr = ext.substring(4); @@ -1696,20 +1709,18 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { if (preext == 'KG') { if (dataori == 0) return '--'; - return numunit(dataori, 1000, ext.substring(3), 'KG|1000|吨'); + return ciyfn.tonumunit(dataori, 1000, ext.substring(3), 'KG|1000|吨'); } if (preext == 'TC') { if (dataori == 0) return '--'; - return numunit(dataori, 1000, ext.substring(3), '℃'); + return ciyfn.tonumunit(dataori, 1000, ext.substring(3), '℃'); } if (preext == 'DB') { if (dataori == 0) return '--'; var pstr = ext.substring(3); var catas = null; - if (once) - catas = once[pstr]; if (!catas) catas = json[pstr]; if (!isarray(catas)) @@ -1735,7 +1746,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) { if (preext == 'MD') { if (!dataori) return ''; - return ciyfn.markdown(dataori); + return '
' + ciyfn.markdown(dataori) + '
'; } return dataori; }; \ No newline at end of file diff --git a/web/jscss/style.css b/web/jscss/style.css index 6c35df9..a5c0762 100644 --- a/web/jscss/style.css +++ b/web/jscss/style.css @@ -1552,35 +1552,35 @@ textarea[disabled], select[disabled], input[disabled], input[disabled]+i, .btn.d padding-left: 0.5em; } -.char9 .ciy-form>label { +.char9 .ciy-form>label,.ciy-form.char9>label { min-width: 9.5em; } -.char8 .ciy-form>label { +.char8 .ciy-form>label,.ciy-form.char8>label { min-width: 8.5em; } -.char7 .ciy-form>label { +.char7 .ciy-form>label,.ciy-form.char7>label { min-width: 7.5em; } -.char6 .ciy-form>label { +.char6 .ciy-form>label,.ciy-form.char6>label { min-width: 6.5em; } -.char5 .ciy-form>label { +.char5 .ciy-form>label,.ciy-form.char5>label { min-width: 5.5em; } -.char4 .ciy-form>label { +.char4 .ciy-form>label,.ciy-form.char4>label { min-width: 4.5em; } -.char3 .ciy-form>label { +.char3 .ciy-form>label,.ciy-form.char3>label { min-width: 3.5em; } -.char2 .ciy-form>label { +.char2 .ciy-form>label,.ciy-form.char2>label { min-width: 2.5em; } @@ -2203,7 +2203,7 @@ textarea.tran:focus, select.tran:focus, input.tran:focus { .md-content { font-size: 1.1em; text-indent: 1em; - padding: 0.3em 1em; + padding: 0.3em 0; line-height: 2em; white-space: pre-wrap; } diff --git a/web/z/index.php b/web/z/index.php index 1b0fd0a..d2b83c1 100644 --- a/web/z/index.php +++ b/web/z/index.php @@ -43,8 +43,8 @@ if (!empty($qstr)) { die; } } - if ($retarr === 'html') - die; + if(!is_array($retarr)) + die('{"errmsg":"无succ返回值"}'); if ($retarr['code'] == 302) { header('Location: ' . $retarr['redirect']); die; diff --git a/zciyphp/comm.php b/zciyphp/comm.php index 71478f7..3d5dadb 100644 --- a/zciyphp/comm.php +++ b/zciyphp/comm.php @@ -136,7 +136,7 @@ function tostr($str = '') { function toint($str = 0) { if (!$str) return 0; - if(!is_numeric($str)) + if (!is_numeric($str)) return 0; return intval(round($str)); } @@ -807,20 +807,11 @@ function savelogfile($types, $msg, $isrequest = false) { * 将调用json_函数名(){} * 函数返回array数组。 */ -function _getmemvar($db, $types, $defvalue = '') { - if (function_exists('getmemvar')) - return getmemvar($db, $types, $defvalue); - return $defvalue; -} function _setmemvar($db, $types, $value) { - if (function_exists('setmemvar')) - return setmemvar($db, $types, $value); + // if (function_exists('setmemvar')) + // return setmemvar($db, $types, $value); return false; } -function _delmemvar($db, $types) { - if (function_exists('delmemvar')) - return delmemvar($db, $types); -} function ciy_ouputJSON($retarr, $ms = 0, $uri = '') { global $db; global $_token; @@ -1074,6 +1065,17 @@ function fileload($dfile) { } return ''; } +//存储文本到文件 +function storsave($filename, $text) { + if (!$filename || !$text) + return false; + $filename = str_replace('{Y}', date('Y'), $filename); + $filename = str_replace('{m}', date('m'), $filename); + $filename = str_replace('{d}', date('d'), $filename); + if (substr($filename, 0, 1) == '/') + $filename = PATH_WEB . 'ud' . $filename; + return filesave($filename, $text); +} function webini($section) { if (!file_exists(PATH_ROOT . 'web.ini')) return 'INI file nofind:' . PATH_ROOT . 'web.ini'; diff --git a/zciyphp/db.php b/zciyphp/db.php index d7d4343..7ba4ca9 100644 --- a/zciyphp/db.php +++ b/zciyphp/db.php @@ -35,15 +35,16 @@ * * 变量名取名尽量用s尾缀区分,建议getone函数使用$xxrow,get函数使用$xxrows。 */ + namespace ciy; class db { //单数据库版 public $linkdb; //写服务器驱动层类实例。 public $dbpst; public $error; + public $pf; public $lock; - function __construct($dbpst = '') { $this->linkdb = false; $this->dbpst = $dbpst; @@ -59,7 +60,7 @@ class db { //单数据库版 $cfg = webini('db' . $this->dbpst); if (is_string($cfg)) die($cfg); - $this->linkdb = new pdo($cfg); + $this->linkdb = new pdo($cfg, $this->pf); $this->linkdb->connect(); return $this->linkdb; } @@ -125,7 +126,7 @@ class db { //单数据库版 * $row['username']... * } */ - function get($csql, &$rowcount = -1) { //$pageno=null 查询全部 + function get($csql, &$rowcount = 0) { //$pageno=null 查询全部 $sql = $csql->buildsql(); $limit = $csql->limit; if ($this->lock) @@ -310,6 +311,17 @@ class db { //单数据库版 $this->error = $this->linkdb->error; return $ret; } + function trace($pf, $rsuser = null) { //traceid全链路跟踪 + if (!preg_match('/^[A-Z]{2}\d{13}_\d{8}$/', $pf)) //防止前端攻击 + $pf = 'ER' . time() . '000_' . rand(10000000, 99999999); + $time = substr($pf, 2, 10); + if (abs(time() - $time) > 10) //跟随服务器时间 + $pf .= ',svrt=' . time(); + if (is_array($rsuser)) + $this->pf = $pf . ',ip=' . getip() . ',uid=' . $rsuser['id']; + else + $this->pf = $pf . ',ip=' . getip() . ',uid=no'; + } function __destruct() { } } diff --git a/zciyphp/pdo.php b/zciyphp/pdo.php index 1e9589c..4f75b35 100644 --- a/zciyphp/pdo.php +++ b/zciyphp/pdo.php @@ -8,11 +8,14 @@ class pdo { public $error; public $lastsql; public $lastdata; + private $pf; //traceid全链路跟踪 private $conn; - function __construct($conn) { + function __construct($conn, $pf = null) { $this->isconnected = false; $this->error = ''; $this->conn = $conn; + $this->pf = $pf; + $this->conn = $conn; } function connect() { if ($this->isconnected) @@ -64,6 +67,8 @@ class pdo { function get($type, $query, $data) { if (!$this->isconnected) return false; + if ($this->pf) + $query = '/* ' . $this->pf . ' */ ' . $query; $rs = $this->_prepare($query, $data); if ($rs === false) return false; @@ -162,6 +167,8 @@ class pdo { function execute($query, $data) { if (!$this->isconnected) return false; + if ($this->pf) + $query = '/* ' . $this->pf . ' */ ' . $query; $rs = $this->_prepare($query, $data); if ($rs === false) return false; @@ -217,7 +224,7 @@ class pdo { if ($arr[0] == 'HY000' && $arr[1] == 2006) { sleep(1); $this->isconnected = false; - if($this->connect()) + if ($this->connect()) continue; } return $this->errsql(false, 'SQL出错:' . $arr[2] . '[' . $arr[0] . '][' . $arr[1] . ']' . $query);