diff --git a/fapp/ciyon_ap/components/ciy-calendar/ciy-calendar.vue b/fapp/ciyon_ap/components/ciy-calendar/ciy-calendar.vue index 918149b..5d3adb9 100644 --- a/fapp/ciyon_ap/components/ciy-calendar/ciy-calendar.vue +++ b/fapp/ciyon_ap/components/ciy-calendar/ciy-calendar.vue @@ -524,18 +524,18 @@ gap: 1em; } - .yearmonth .today { - flex: none; - padding-right: 0.5em; - white-space: nowrap; - } - .yearmonth>.itm { flex: 1; display: flex; align-items: center; } + .yearmonth .today { + flex: none; + padding-right: 0.5em; + white-space: nowrap; + } + .yearmonth .maintxt { flex: 1; text-align: center; diff --git a/fapp/ciyon_ap/components/ciy-inputcyc/ciy-inputcyc.vue b/fapp/ciyon_ap/components/ciy-inputcyc/ciy-inputcyc.vue index 0528e22..3e60297 100644 --- a/fapp/ciyon_ap/components/ciy-inputcyc/ciy-inputcyc.vue +++ b/fapp/ciyon_ap/components/ciy-inputcyc/ciy-inputcyc.vue @@ -5,7 +5,7 @@ - + @@ -46,23 +46,14 @@ type: Boolean, default: false }, + range: { + type: String, + default: 'month,day,min' + }, }, data() { return { v: '', - range: [{ - id: 'month', - name: this.lang('cyc.month') - }, { - id: 'day', - name: this.lang('cyc.day') - }, { - id: 'min', - name: this.lang('cyc.min') - }, { - id: 'sec', - name: this.lang('cyc.sec') - }], num: 0, unit: '' }; @@ -85,12 +76,31 @@ return -this.toint(this.num); } else if (this.unit == 'day') { return this.toint(this.num) * 86400; + } else if (this.unit == 'hour') { + return this.toint(this.num) * 3600; } else if (this.unit == 'min') { return this.toint(this.num) * 60; } else { return this.num; } - } + }, + trange() { + var rg = []; + var rs = this.range.split(','); + for (var i = 0; i < rs.length; i++) { + rg.push({ + id: rs[i], + name: this.lang('cyc.' + rs[i]) + }) + } + return rg; + }, + trowcnt() { + var cnt = this.range.split(',').length; + if(cnt > 4) + return 3; + return cnt; + }, }, mounted() { this.setvalue(this.value || this.modelValue); @@ -117,6 +127,9 @@ } else if (vi % 86400 == 0) { unit = 'day'; num = this.toint(vi / 86400); + } else if (vi % 3600 == 0) { + unit = 'hour'; + num = this.toint(vi / 3600); } else if (vi % 60 == 0) { unit = 'min'; num = this.toint(vi / 60); diff --git a/fapp/ciyon_ap/components/ciy-inputnumber/ciy-inputnumber.vue b/fapp/ciyon_ap/components/ciy-inputnumber/ciy-inputnumber.vue index 717e1a4..4ebf329 100644 --- a/fapp/ciyon_ap/components/ciy-inputnumber/ciy-inputnumber.vue +++ b/fapp/ciyon_ap/components/ciy-inputnumber/ciy-inputnumber.vue @@ -74,9 +74,7 @@ } }, mounted() { - if (this.initevent) { - this.emit(this.innervalue, 'init'); - } + this.emit(this.innervalue, this.initevent ? 'init' : ''); }, methods: { emit(val, from) { @@ -91,11 +89,13 @@ this.$emit('update:modelValue', val); } else {} this.tvalue = val; - this.$emit('change', { - name: this.name, - from: from, - value: val - }); + if (from) { + this.$emit('change', { + name: this.name, + from: from, + value: val + }); + } this.old = val; }, textinput(e) { diff --git a/fapp/ciyon_ap/components/ciy-segment/ciy-segment.vue b/fapp/ciyon_ap/components/ciy-segment/ciy-segment.vue index 5768dec..e27b504 100644 --- a/fapp/ciyon_ap/components/ciy-segment/ciy-segment.vue +++ b/fapp/ciyon_ap/components/ciy-segment/ciy-segment.vue @@ -12,7 +12,7 @@ \ No newline at end of file diff --git a/fapp/ciyon_ap/components/ciy-switch/ciy-switch.vue b/fapp/ciyon_ap/components/ciy-switch/ciy-switch.vue index a035aaf..48d0dc9 100644 --- a/fapp/ciyon_ap/components/ciy-switch/ciy-switch.vue +++ b/fapp/ciyon_ap/components/ciy-switch/ciy-switch.vue @@ -102,7 +102,7 @@ }, data() { return { - v: '', + v: false, anidatabg: {}, anidatay: {}, anidatan: {}, diff --git a/fapp/ciyon_ap/util/ciy.js b/fapp/ciyon_ap/util/ciy.js index 2b5163a..35cb39f 100644 --- a/fapp/ciyon_ap/util/ciy.js +++ b/fapp/ciyon_ap/util/ciy.js @@ -800,7 +800,7 @@ export default { this.sysinfo = app.globalData._sysinfo; this.jsnurl = app.globalData.jsnurl; this.me = this.getme(); - if(app.globalData.ciy_page_g) + if (app.globalData.ciy_page_g) this.g = app.globalData.ciy_page_g; else this.g = this.getstorage('g', {}); @@ -833,6 +833,37 @@ export default { opt.pagethis = this; return getApp().callajax(opt); }, + calltxt(opt) { + return new Promise((resolve, reject) => { + opt = opt || {}; + uni.request({ + url: opt.url, + data: opt.data, + dataType: 'text', + method: opt.data ? 'POST' : 'GET', + header: opt.header, + fail: res => { + var errmsg = res.errMsg || 'nofind errMsg.'; + if (errmsg.indexOf('fail abort') > 0) + errmsg = '网络信号不好'; + else if (errmsg.indexOf('equest:fail timeout') > 0) + errmsg = '网络访问超时'; + else if (errmsg.indexOf('equest:fail') > 0) + errmsg = '网络不可用'; + return reject({ + errmsg: errmsg + }); + }, + success: res => { + if (res.statusCode == 200) + return resolve(res.data); + return reject({ + errmsg: res.data + }); + } + }); + }); + }, getme() { return getApp().getme(); }, @@ -893,7 +924,7 @@ export default { animationDuration: 1000 }); } else if (url.substring(0, 1) == '*') { - this.alert(dataset.url.substring(1)); + this.alert(url.substring(1)); } else { if (url.substring(0, 1) == '$') { url = url.substring(1); @@ -1323,17 +1354,25 @@ export default { }, tonumdec(num, showzero, len) { len = len || 2; // 与tofix不同点,小数长度不变,如 1.10 - var m2 = Math.ceil((num - parseInt(num)) * 100); - if (m2 < 10) - m2 = '0' + m2; - else - m2 = m2 + ''; - if (showzero) - return '.' + m2; - if (m2 == '00') - return ''; - else - return '.' + m2; + var m2 = Math.round((num - parseInt(num)) * Math.pow(10, len)); + if (m2 == 0) { + if (showzero) + return '.' + '0'.repeat(len); + else + return ''; + } + m2 = m2 + ''; + if (m2.length < len) + m2 = '0'.repeat(len - m2.length) + m2; + return '.' + m2; + }, + tocciy(cciy) { + var hex = cciy.toString(16).toUpperCase(); + hex = hex.substring(hex.length - 12); + hex = hex.replace(/^0+/, ''); + if (hex.length < 7) + hex = '0'.repeat(7 - hex.length) + hex; + return 'cx...' + hex.substring(0, hex.length - 1); }, tostr(obj) { if (!obj) diff --git a/fapp/ciyon_ap/util/lang/zh-Hans.json b/fapp/ciyon_ap/util/lang/zh-Hans.json index fea4660..fc9e19c 100644 --- a/fapp/ciyon_ap/util/lang/zh-Hans.json +++ b/fapp/ciyon_ap/util/lang/zh-Hans.json @@ -39,6 +39,7 @@ "query.btn_reset":"重置", "query.btn_close":"关闭", + "page.btn_pub":"发布", "page.btn_submit":"提交", "page.btn_refresh":"刷新", "page.loading":"加载中", @@ -79,6 +80,7 @@ "cyc.month": "月", "cyc.day": "天", + "cyc.hour": "小时", "cyc.min": "分钟", "cyc.sec": "秒", diff --git a/fapp/ciyon_ap/util/style.css b/fapp/ciyon_ap/util/style.css index a2e7c4a..985349f 100644 --- a/fapp/ciyon_ap/util/style.css +++ b/fapp/ciyon_ap/util/style.css @@ -252,6 +252,23 @@ text { opacity: 0.5; } +.ciy-list .title { + position: relative; + color: var(--txt9); + font-weight: bold; + margin-left: 1em; +} + +.ciy-list .title::before { + content: ''; + position: absolute; + left: -1em; + width: 0.5em; + height: 1.5em; + border-radius: 5px; + background: linear-gradient(-60deg, var(--man4), var(--man7)); +} + .ciy-list .l0 { font-size: 0.8em; padding-right: 6em; @@ -266,7 +283,6 @@ text { .ciy-list .l2 { display: flex; align-items: center; - min-height: 2em; } .ciy-list .l2>label { @@ -952,27 +968,27 @@ text { text-decoration: underline; } -.txt-left { +.txt-left.txt-left { text-align: left; } -.txt-center { +.txt-center.txt-center { text-align: center; } -.txt-right { +.txt-right.txt-right { text-align: right; } -.txt-just { +.txt-just.txt-just { text-align: justify; } -.txt-nowrap { +.txt-nowrap.txt-nowrap { white-space: nowrap; } -.txt-over { +.txt-over.txt-over { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; diff --git a/web/admin/ap/cash_ie.html b/web/admin/ap/cash_ie.html new file mode 100644 index 0000000..8f5896a --- /dev/null +++ b/web/admin/ap/cash_ie.html @@ -0,0 +1,95 @@ + + + + + + + + + + + + +
+ +
+
Loading...
+
+
+
+ 全选 + 反选 + | + 批量删除 +
+
+
+
+
+ + + + + + + + + + \ No newline at end of file diff --git a/web/admin/ap/cash_ie.php b/web/admin/ap/cash_ie.php new file mode 100644 index 0000000..ee9ea16 --- /dev/null +++ b/web/admin/ap/cash_ie.php @@ -0,0 +1,185 @@ +get('query'); + $csql = new \ciy\sql('ap_cash_ie'); + $liid = objint($query, 'liid'); + if ($liid > 0) + $csql->where('cashietype', $liid); + $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->wherenumrange('iemoney', objstr($query, 'iemoney_1'), objstr($query, 'iemoney_2'), 100); + $csql->wheredaterange('addtimes', objstr($query, 'addtimes')); + $csql->where('name like', objstr($query, 'name')); + $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('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); + if ($post->getbool('field')) { + $field = array(); + $fshow = $db->getfield($field, 'ap_cash_ie'); + foreach ($field as $fr => $v) { + if (get('_' . $fr)) + $field[$fr]['c'] = ',' . $field[$fr]['c']; + } + $ret['field'] = $field; + $ret['fshow'] = $fshow; + } + if ($post->getbool('once')) { + $ret['once'] = array(); + $input = array(); + $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"'); + $input[] = array('type' => 'num', 'form' => 'iemoney', 'name' => '金额', 'prop' => ' style="width:4em;"'); + $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '发生时间'); + $input[] = array('type' => 'input', 'form' => 'name', 'name' => '摘要', 'prop' => ' style="width:8em;"'); + $ret['once']['input'] = $input; + } + $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser'); + return succjson($ret); + } + + public static function json_getdata() { + global $db; + $rsuser = verifyfast(); + $post = new \ciy\post(); + $id = $post->getint('id'); + $act = $post->get('act'); + if ($id > 0) { + $csql = new \ciy\sql('ap_cash_ie'); + $csql->where('id', $id); + $row = $db->getone($csql); + if (!is_array($row)) + return errjson('数据不存在'); + if ($act == 'view' || $act == 'review') { + $csql = (new \ciy\sql('ap_user'))->column('id,name'); + $csql->where('id', $row['vuser']); + $ret['ap_user'] = $db->get($csql); + } + } else { + $row = array(); + } + $ret['data'] = $row; + if ($act == 'edit') { + $csql = (new \ciy\sql('ap_user'))->column('id,name'); + $ret['ap_user'] = $db->get($csql); + } + 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_ie'); + $csql->where('id in', $ids); + $rows = $db->get($csql); + $vids = array(); + try { + $db->begin(); + foreach ($rows as $row) { + $delid = $row['id']; + //delcheck($db, $delid, 'tablexx', 'xxid', '管理员'); + //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall + delme($db, $delid, 'ap_cash_ie'); + savelogdb($db, $rsuser['id'], 'ap_cash_ie', $row, null); + $vids[] = $delid; + } + $db->commit(); + } catch (\Exception $ex) { + $db->rollback(); + 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' => 'cashietype', 'name' => '收支分类'); + $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户'); + $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'iemoney', 'name' => '金额'); + $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '发生时间'); + $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '摘要'); + $code_cashietype = getcatas($db, 'cashietype'); + $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name'); + $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 == 'cashietype') + $val = ccode($code_cashietype, $val); + if ($field == 'vuser') + $val = ccode($code_vuser, $val); + if ($field == 'iemoney') + $val = number_format($val / 100, 2); + if ($field == 'addtimes') + $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)); + } +} diff --git a/web/admin/ap/cash_in.html b/web/admin/ap/cash_in.html index aef2159..df603ca 100644 --- a/web/admin/ap/cash_in.html +++ b/web/admin/ap/cash_in.html @@ -56,7 +56,7 @@ searchdom: '.search' , data: json , liall: '全部' - , lidata: 'cashintype' + , lidata: [{ id: 1, name: '未支付' }, { id: 2, name: '已支付' }] , liclick: function (dom) { table.search(dom, 'li'); } diff --git a/web/admin/ap/cash_in.php b/web/admin/ap/cash_in.php index 7b8464d..8779b86 100644 --- a/web/admin/ap/cash_in.php +++ b/web/admin/ap/cash_in.php @@ -7,8 +7,10 @@ class cash_in { $query = $post->get('query'); $csql = new \ciy\sql('ap_cash_in'); $liid = objint($query, 'liid'); - if ($liid > 0) - $csql->where('cashintype', $liid); + if ($liid == 1) + $csql->where('paytimes=0'); + if ($liid == 2) + $csql->where('paytimes>0'); $val = objstr($query, 'vuser'); if (!empty($val)) { $csqlt = new \ciy\sql('ap_user'); diff --git a/web/ambap/me.php b/web/ambap/me.php index 521ab74..31ea025 100644 --- a/web/ambap/me.php +++ b/web/ambap/me.php @@ -388,7 +388,7 @@ class me { $param['out_bill_no'] = 'TB' . date('ymd') . '8' . $id; $param['transfer_scene_id'] = '1005'; $param['openid'] = $rsuser['wxminaid']; - $param['notify_url'] = 'https://expo.ciy.cn/ajax/amb/wxpay.transfer'; + $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(); @@ -617,7 +617,7 @@ class me { $param = array(); $param['description'] = '购买金币'; $param['out_trade_no'] = 'PT' . date('ymd') . '9' . $orderid; - $param['notify_url'] = 'https://expo.ciy.cn/ajax/amb/wxpay.pay_pnt'; + $param['notify_url'] = 'https://ciyon.ciy.cn/ajax/ambap/wxpay.pay_pnt'; $param['amount'] = array(); $param['amount']['total'] = (int)$payprice; $param['payer'] = array(); @@ -705,7 +705,7 @@ class me { $param = array(); $param['description'] = '购买会员'; $param['out_trade_no'] = 'UB' . date('ymd') . '9' . $orderid; - $param['notify_url'] = 'https://ciyon.ciy.cn/ajax/amb/wxpay.pay_user'; + $param['notify_url'] = 'https://ciyon.ciy.cn/ajax/ambap/wxpay.pay_user'; $param['amount'] = array(); $param['amount']['total'] = (int)$money; $param['payer'] = array(); @@ -780,16 +780,82 @@ class me { $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'] = (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_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 > 0) - $csql->where('cashtype', $liid); + if ($liid == 1) + $csql->where('cashietype<100'); + if ($liid == 2) + $csql->where('cashietype>=100'); $csql->order(objstr($query, 'order', 'id desc')); $pageno = $post->getint('pageno', 1); $pagecount = $post->getint('pagecount', 10); diff --git a/web/ambap/wxpay.php b/web/ambap/wxpay.php index 862dd43..740578d 100644 --- a/web/ambap/wxpay.php +++ b/web/ambap/wxpay.php @@ -3,7 +3,74 @@ //http://expo.local.ciy.cn/ajax/amb/wxpay.transfer namespace web\ambap; -class wxpay_pnt { +class wxpay { + public static function json_charge() { + global $db; + $msg = file_get_contents('php://input'); + savelogfile('wxpay_charge', '', true); + if (empty($msg)) + $msg = '{"id":"601ce864-430c-5dc6-bb14-99ba0e75092a","create_time":"2025-06-18T00:55:47+08:00","resource_type":"encrypt-resource","event_type":"TRANSACTION.SUCCESS","summary":"支付成功","resource":{"original_type":"transaction","algorithm":"AEAD_AES_256_GCM","ciphertext":"tWglulTGTqVaw5FkYXOoAlksz62KOC3726nN0EFkCHXV4mWARk+k5sVhmnglBUG5RO+JLRcADO+xY1fX2kP2wrk7YOAGstM2SQfnoxzlur1HmnWtIamBQ+38UnsH+mi0a4WGMsMDIgqa1YmvklXrlsiS5DXVxYF13tvlXGDeM8atLFprGPs50lSYz6x0XfobMMaiM3S37BE574QDFMTuEaKQkA9P0AkQIQ4LvHTAzg1qZuaJ5uly7Zs+ViMEF9bG7l808cG2/jNtrG8Nu9VD3GyjRTUPX+OnHjWnwuBF+XRpDSLUioophdK0fGvC5Z7wJg1PpJYkTm5m4Fk93i9ao3d8uY7oV8ekQ3GpD+JlJzCoPk30cPC9+UyxiupvvJJK50AzsyXwZ7BU4YIvXEjBUJstcntb5gTFgaICKQCqpIgSKgcrVkDdb8i3IuA17Z1wAJqJQdknx6eLVuelwxbISEtL8v+a9moCjsRPqzJ7HTOkxcujh+SWSftx2f9MEKOxIem1HLr0t4zhVDqwx2Hgnk+YoLdXQ3CdJNXk4435H403gUeNwuAOpemy","associated_data":"transaction","nonce":"Vw6lMyykEja3"}}'; + + $json = json_decode($msg, true); + if ($json === null) + return self::errlog('回调JSON出错:' . $msg); + if (@$json['event_type'] != 'TRANSACTION.SUCCESS') + return self::errlog('支付失败:' . $msg); + $wxcfg = gettoken($db, 1); + $aesKey = $wxcfg['v3key']; //v3秘钥 + $associatedData = $json['resource']['associated_data']; + $nonceStr = $json['resource']['nonce']; + $ciphertext = $json['resource']['ciphertext']; + $dat = \sodium_crypto_aead_aes256gcm_decrypt(base64_decode($ciphertext), $associatedData, $nonceStr, $aesKey); + //clog($dat); + //{"mchid":"1521600371","appid":"wx04060908b8fb3341","out_trade_no":"E2049007187","transaction_id":"4200002494202412238883646214","trade_type":"JSAPI","trade_state":"SUCCESS","trade_state_desc":"支付成功","bank_type":"OTHERS","attach":"87,1,oUlwX5Tv9jYjlENyvCFQtMrmT3Ok","success_time":"2024-12-23T06:44:43+08:00","payer":{"openid":"oUlwX5Tv9jYjlENyvCFQtMrmT3Ok"},"amount":{"total":1,"payer_total":1,"currency":"CNY","payer_currency":"CNY"}} + if ($dat === false) + return self::errlog('解析密文出错:' . $msg); + $json = json_decode($dat, true); + if ($json === null) + return self::errlog('解析密文JSON出错:' . $dat); + if (@$json['trade_state'] != 'SUCCESS') + return self::errlog('支付失败:' . $dat); + $noid = (int)substr($json['out_trade_no'], 9); + $csql = new \ciy\sql('ap_cash_in'); + $csql->where('id', $noid); + $orderrow = $db->getone($csql); + if (!is_array($orderrow)) + return self::errlog('订单不存在:' . $noid); + $userid = $orderrow['vuser']; + $inmoney = (int)$orderrow['inmoney']; + if ($inmoney != $json['amount']['total']) + return self::errlog('订单金额错误[' . $inmoney . '!=' . $json['amount']['total'] . ']:' . $noid, $userid); + if ($orderrow['paytimes'] > 0) { + savelogfile('wxpay_charge', '已充值[' . $noid . ']'); + return succjson(); + } + + try { + $db->begin(); + $updata = array(); + $updata['name'] = $json['transaction_id']; + $updata['paytimes'] = tostamp(); + $csql = new \ciy\sql('ap_cash_in'); + $csql->where('id', $noid); + if ($db->update($csql, $updata) === false) + throw new \Exception('更新ap_cash_in失败:' . $db->error); + //sendusermsg($db, $orderrow['userid'], '集市通知', '买家已付款,请及时处理', '/work/ec/order_detail?id=' . $noid); + + $updata = array(); + $updata['mycashmoney'] = array('mycashmoney+' . $inmoney); + $csql = new \ciy\sql('ap_user'); + $csql->where('id', $userid); + if ($db->update($csql, $updata) === false) + throw new \Exception('更新ap_user失败:' . $db->error); + $db->commit(); + } catch (\Exception $ex) { + $db->rollback(); + return self::errlog($ex->getMessage(), $userid); + } + savelogfile('wxpay_charge', '成功充值[' . $noid . ']'); + return succjson(); + } public static function json_transfer() { global $db; $msg = file_get_contents('php://input'); @@ -103,7 +170,7 @@ class wxpay_pnt { if (!is_array($orderrow)) return self::errlog('订单不存在:' . $noid); $userid = $orderrow['vuser']; - $buypntmoney = (int)($orderrow['buypntmoney']/100); + $buypntmoney = (int)$orderrow['buypntmoney']; if ($buypntmoney != $json['amount']['total']) return self::errlog('订单金额错误[' . $buypntmoney . '!=' . $json['amount']['total'] . ']:' . $noid, $userid); if ($orderrow['paytimes'] > 0) { diff --git a/web/jscss/ciy.js b/web/jscss/ciy.js index 6c89f0c..39c3068 100644 --- a/web/jscss/ciy.js +++ b/web/jscss/ciy.js @@ -1828,22 +1828,16 @@ ciyfn.dropmenu = function (dom) { var left = domrect.left; var uldom = $5('ul', dom); var ulrect = uldom.rect(); - var menuwidth = toint(uldom.attr('mewidth')); - if (menuwidth == 0) { - menuwidth = ulrect.width; - uldom.attr('mewidth', menuwidth); - } + uldom.css('inset', null); + var menuwidth = ulrect.width; + var menuheight = ulrect.height; dom.css('zIndex', 30); if ($5(document).width() < left + menuwidth) { left = $5(document).width() - menuwidth; } - var menuheight = toint(uldom.attr('meheight')); - if (menuheight == 0) { - menuheight = ulrect.height; - uldom.attr('meheight', menuheight); - } if (left < 0) left = 0; + if (top + menuheight + 40 < document.documentElement.clientHeight) { top += domrect.height; uldom.css({ 'position': 'fixed', 'left': left + 'px', 'top': top + 'px', 'bottom': 'auto' }); diff --git a/web/jscss/style.css b/web/jscss/style.css index 7000be2..e6f21bc 100644 --- a/web/jscss/style.css +++ b/web/jscss/style.css @@ -1922,7 +1922,6 @@ textarea.tran:focus, select.tran:focus, input.tran:focus { .ciy-popmenu { display: none; position: absolute; - left: 0; background: var(--bg4); border: 1px solid var(--bg6); color: var(--txt7);