diff --git a/addons/weliam_smartcity/requests/printing.php b/addons/weliam_smartcity/requests/printing.php new file mode 100644 index 0000000..c650d88 --- /dev/null +++ b/addons/weliam_smartcity/requests/printing.php @@ -0,0 +1,26 @@ +model('attachment'); +$_W['siteroot'] = str_replace(array('/addons/'.MODULE_NAME.'/payment','/addons/weliam_smartcity/payment'), '', $_W['siteroot']); +//获取打印数据 +Util::wl_log('printing_request', PATH_MODULE."log/",$_REQUEST,'请求打印 —— 接收信息'); //写入日志记录 +$tid = $_REQUEST['tid']; +$data = Printing::getPrintingData($tid); +$jsonInfo = json_encode($data,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES); +Util::wl_log('printing_request', PATH_MODULE."log/",$jsonInfo,'请求打印 —— 输出打印信息'); //写入日志记录 +header('Content-type: rjson'); +echo $jsonInfo; + diff --git a/addons/weliam_smartcity/sys/common/cover.func.php b/addons/weliam_smartcity/sys/common/cover.func.php new file mode 100644 index 0000000..1113f02 --- /dev/null +++ b/addons/weliam_smartcity/sys/common/cover.func.php @@ -0,0 +1,48 @@ + time()) && !IS_DEV) { + $version = pdo_getcolumn('modules', array('name' => MODULE_NAME), 'version'); + if ($version != WELIAM_VERSION) { + header("Location: " . web_url('cloud/auth/upgrade', ['up' => 'now'])); + exit; + } +} + +if(!empty(strstr($_W['siteroot'],'zbczc.com'))){ + wl_message("此域名被禁止访问!请联系管理员。"); +} + + +//以下是代理商员工权限的操作。当前登录的账号为员工账号.进行权限判断 +$ESession = json_decode(base64_decode($_GPC['__wlsystem_staff_session']), true); +if($ESession){ + //判断该员工账号是否存在 Employee information 。并且获取该员工的权限信息 + if(!$ESession['uniacid'] && $_W['uniacid'] > 0) $ESession['uniacid'] = $_W['uniacid']; + $_W['EInfor'] = $EInfo = pdo_get(PDO_NAME."agentadmin",$ESession); + if(!$EInfo){ + //员工不存在/已被删除 + isetcookie('__session', '', -10000);//删除代理商登录信息 + isetcookie('__wlsystem_staff_session', '', -10000);//删除员工登录信息 + wl_message("您的信息不存在!请联系管理员。", web_url('user/login/adminStaffLogin')); + } + //判断是否存在uniacid + if(!$_W['uniacid']) $_W['uniacid'] = $EInfo['uniacid']; + + + //获取当前员工的权限路径列表 判断是否拥有访问权限 + $_W['jurisdiction'] = unserialize($EInfo['jurisdiction']); + if(count($_W['jurisdiction']) <= 0) wl_message("对不起!您没有访问权限。", getenv("HTTP_REFERER")); + //调用权限方法 获取跳转地址 + Jurisdiction::judge(); +} + diff --git a/addons/weliam_smartcity/sys/controller/app/plugins.ctrl.php b/addons/weliam_smartcity/sys/controller/app/plugins.ctrl.php new file mode 100644 index 0000000..efe1150 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/app/plugins.ctrl.php @@ -0,0 +1,21 @@ +func('file'); + +class Auth_WeliamController { + + public function __construct() { + global $_W; + if (!$_W['isfounder']) { + wl_message('无权访问!'); + } + } + + public function auth() { + global $_W, $_GPC; + $auth = Cloud::auth_info(); + if (is_error($auth)) { + wl_message($auth['message'], referer(), 'warning'); + } + if (!empty($auth['plugins']) && $auth['encrypt'] == 1 && !file_exists(PATH_MODULE . 'check.php')) { + Cloud::files_plugin_exit($auth['plugins']); + } + + $auth['status'] = ($auth['status'] == 1) ? '禁用中' : ($auth['endtime'] < time() ? '已过期' : '已授权'); + $auth['number'] = '不限制'; + $auth['version'] = 'V' . $auth['version']; + $auth['endtime'] = date("Y-m-d", $auth['endtime']); + + if(Customized::init('distributionText') > 0){ + $auth['name'] = str_replace('智慧城市同城','门店共享系统',$auth['name']); + } + + include wl_template('cloud/auth'); + } + + public function upgrade() { + global $_W, $_GPC; + if ($_W['isajax']) { + if (file_exists(PATH_MODULE . 'check.php')) { + wl_json(1, '开发环境禁止更新'); + } + + //获取最新版本的文件 + $files_md5 = Cloud::api_post(array('do' => 'files_md5', 'url' => $_W['siteroot'])); + if ($files_md5['code'] != 0) { + wl_json($files_md5['code'], $files_md5['message']); + } + + $files = array(); + if (!empty($files_md5['data'])) { + foreach ($files_md5['data'] as $file) { + if(IMS_FAMILY == 'wl'){ + $entry = IA_ROOT.'/'.$file['path']; + }else{ + $entry = PATH_MODULE . $file['path']; + } + //判断当前文件是否需要进行更新 + if($this->notUpgradeFile($entry)) continue; + //储存需要更新的文件信息 + if (!is_file($entry) || md5_file($entry) != $file['md5']) { + $files[] = array('path' => $file['path'], 'download' => 0, 'entry' => $entry); + } + } + } + if (!empty($files)) { + file_put_contents(FILES_UP_PATH, json_encode($files)); + wl_json(0, '', ['count' => count($files)]); + } + pdo_update('modules', array('version' => WELIAM_VERSION), array('name' => MODULE_NAME)); + wl_json(1, '已是最新版本,无需进行更新'); + } + + $log = []; + $update_logs = Cloud::api_post(array('do' => 'get_update_log', 'url' => $_W['siteroot'], 'page' => intval($_GPC['page']))); + if ($update_logs['code'] == 0) { + $log = $update_logs['data']['logs'][0]; + } + if (file_exists(PATH_MODULE . 'manifest.xml') && !IS_DEV) { + unlink(PATH_MODULE . 'manifest.xml'); + } + + include wl_template('cloud/upgrade'); + } + + public function upgrade_download() { + + global $_W, $_GPC; + // wl_debug(MODULE_NAME); + if (!file_exists(FILES_UP_PATH)) { + wl_json(1, '不存在需要更新的文件或更新异常'); + } + //清理opcache缓存 + if (ini_get('opcache.enable') || ini_get('opcache.enable_cli')) { + opcache_reset(); + } + + $files = json_decode(file_get_contents(FILES_UP_PATH), true); + $count_files = count($files); + //判断是否存在需要更新的文件 + $key = $path = $success = 0; + foreach ($files as $k => &$f) { + if (empty($f['download'])) { + $path = $f['path']; + $key = $k; + break; + } else { + $success++; + } + } + + if (!empty($path)) { + + $files_up = Cloud::api_post(array('do' => 'files_get', 'url' => $_W['siteroot'], 'path' => $path)); + if ($files_up['code'] != 0) { + wl_json(1, $files_up['message'], array('total' => $count_files, 'success' => $success)); + } + $content = base64_decode(trim($files_up['data'])); + //根据路径创建目录和文件 + if(IMS_FAMILY == 'wl'){ + FilesHandle::file_mkdirs(dirname(IA_ROOT.'/'. $path)); + }else{ + FilesHandle::file_mkdirs(dirname(PATH_MODULE . $path)); + } + //修改文件内容 + $fileName = basename($path,'.'.pathinfo($path)['extension']); + $fileName = ucfirst(preg_replace_callback('/([-_]+([a-z]{1}))/i', function ($matches) { + return strtoupper($matches[2]); + }, $fileName)); + $funName = "update{$fileName}Content"; + if(method_exists($this,$funName)) $content = $this->$funName($content); + //替换 h5中模块标志 + if ((strpos($path, 'index.html') !== false || strpos($path, 'static/js/index.') !== false) && MODULE_NAME != 'weliam_smartcity') { + $content = str_replace('weliam_smartcity', MODULE_NAME, $content); + } + //覆盖更新文件内容 + if(strpos($path, 'auth.ctrl.php') === false){ + if(IMS_FAMILY == 'wl'){ + file_put_contents(IA_ROOT.'/' . $path, $content); + }else{ + file_put_contents(PATH_MODULE . $path, $content); + } + } + // wl_debug($content); + //修改文件下载状态 + $files[$key]['download'] = 1; + file_put_contents(FILES_UP_PATH, json_encode($files)); + + wl_json(0, '', array('total' => $count_files, 'success' => $success + 1)); + } else { + //更新版本号 + touch(VERSION_PATH); + pdo_update('modules', array('version' => WELIAM_VERSION), array('name' => MODULE_NAME)); + //删除更新文件列表 + unlink(FILES_UP_PATH); + wl_json(2, ''); + } + } + + public function upgrade_db() { + global $_W, $_GPC; + $sqlcache = Cache::getCache('upgrade', 'db'); + if (empty($sqlcache)) { + $sqls = Cloud::auth_up_data(); + $sqlcache = ['total' => count($sqls), 'success' => 0, 'sqls' => $sqls]; + } + + if (!empty($sqlcache['sqls'])) { + if (is_array($sqlcache['sqls'][0])) { + switch ($sqlcache['sqls'][0]['type']) { + case 'store_cate': + Cloud::data_store_cate($sqlcache['sqls'][0]['sid']); + break; + } + } else { + pdo_query($sqlcache['sqls'][0]); + } + + $sqlcache['success'] = $sqlcache['success'] + 1; + unset($sqlcache['sqls'][0]); + $sqlcache['sqls'] = array_values($sqlcache['sqls']); + Cache::setCache('upgrade', 'db', $sqlcache); + + wl_json(0, '', array('total' => $sqlcache['total'], 'success' => $sqlcache['success'])); + } + + Cache::deleteCache('upgrade', 'db'); + wl_json(1, ''); + } + + public function upgrade_log() { + global $_W, $_GPC; + if ($_W['isajax']) { + $update_logs = Cloud::api_post(array('do' => 'get_update_log', 'url' => $_W['siteroot'], 'page' => intval($_GPC['page']))); + if ($update_logs['code'] != 0) { + wl_json(1, $update_logs['message']); + } + foreach ($update_logs['data']['logs'] as &$log) { + $log['content'] = htmlspecialchars_decode($log['content']); + $log['year'] = date('Y-m', $log['updated_at']); + $log['day'] = date('d', $log['updated_at']); + $log['hour'] = date('H:i:s', $log['updated_at']); + } + + wl_json(0, '', $update_logs['data']); + } + include wl_template('cloud/upgrade_log'); + } + + + /** + * Comment: 判断当前文件是否需要进行更新 + * Author: zzw + * Date: 2020/8/21 12:12 + * @param $path + * @return bool + */ + public function notUpgradeFile($path){ + $status = false; + if(strpos($path, '/plugin/weliam_house') !== false){ + //无需更新文件 + $notFile = [ + '.txt' , + '.zip' , + 'check.php' , + '.md' , + 'LICENSE' , + '.gitignore' ,//git限制更新文件 + 'runtime' ,//缓存文件 + 'public/file/image' ,//本地图片储存路径 + 'public/file/qrcode' ,//二维码储存地址 + 'public/file/video' ,//本地视频储存地址 + 'public/file/log' ,//日志信息记录 + 'public/w7_wl_house_install.zip' ,//微擎版安装包 + 'public/uploads' ,//本地图片储存地址(已弃用) + ]; + foreach($notFile as $notFilePath){ + if(strpos($path, $notFilePath) !== false) { + $status = true; + break; + } + } + //只在第一次进入时更新的文件(需要安装单不能更新的文件) + $oneFile = [ + 'addons/address/config.php' ,//fastadmin第三方插件 - 地图插件配置文件, + 'addons/alisms/config.php' ,//fastadmin第三方插件 - 阿里云短信配置文件, + 'application/system/sys_config.php' ,//总后台配置文件 + 'application/database.php' ,//数据库配置文件 + ]; + if(!$status){ + foreach($oneFile as $noeFilePath){ + if(strpos($path, $noeFilePath) !== false && file_exists($path)){ + $status = true; + break; + } + } + } + } + return $status; + } + /** + * Comment: 数据库文件初始化内容 + * Author: zzw + * Date: 2020/8/21 14:46 + * @param $content + * @return string + */ + protected function updateDatabaseContent($content){ + //内容替换 + $html = ' + Env::get(\'database.type\', \'mysql\'), + \'hostname\' => Env::get(\'database.hostname\', \'__HOSTNAME__\'), // 服务器地址 + \'database\' => Env::get(\'database.database\', \'__DATABASE__\'),// 数据库名 + \'username\' => Env::get(\'database.username\', \'__USERNAME__\'),// 用户名 + \'password\' => Env::get(\'database.password\', \'__PASSWORD__\'),// 密码 + \'hostport\' => Env::get(\'database.hostport\', \'__HOSTPORT__\'),// 端口 + // 连接dsn + \'dsn\' => \'\', + // 数据库连接参数 + \'params\' => [], + // 数据库编码默认采用utf8 + \'charset\' => Env::get(\'database.charset\', \'utf8\'), + // 数据库表前缀 + \'prefix\' => Env::get(\'database.prefix\', \'__PREFIX__\'), + // 数据库调试模式 + \'debug\' => Env::get(\'database.debug\', false), + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + \'deploy\' => 0, + // 数据库读写是否分离 主从式有效 + \'rw_separate\' => false, + // 读写分离后 主服务器数量 + \'master_num\' => 1, + // 指定从服务器序号 + \'slave_no\' => \'\', + // 是否严格检查字段是否存在 + \'fields_strict\' => true, + // 数据集返回类型 + \'resultset_type\' => \'array\', + // 自动写入时间戳字段 + \'auto_timestamp\' => true, + // 时间字段取出后的默认时间格式,默认为Y-m-d H:i:s + \'datetime_format\' => false, + // 是否需要进行SQL性能分析 + \'sql_explain\' => false, +];'; + + return $html; + } + + + +} diff --git a/addons/weliam_smartcity/sys/controller/cloud/database.ctrl.php b/addons/weliam_smartcity/sys/controller/cloud/database.ctrl.php new file mode 100644 index 0000000..4166ea3 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/cloud/database.ctrl.php @@ -0,0 +1,956 @@ + 0, + 'alldismoney' => 0, + 'allstoremoney' => 0, + ); + $commentSql = "select checkcode,merchantid,type,orderno,goodsid,goodsid,agentmoney,createtime,merchantmoney,distrimoney,aid,count(id) as count from" . tablename(PDO_NAME . "autosettlement_record") . "group by checkcode having count > 1 AND checkcode > 0 "; + $lists = pdo_fetchall($commentSql); + if (!empty($lists)) { + foreach ($lists as $key => &$va) { + $va['storename'] = pdo_getcolumn(PDO_NAME . 'merchantdata', array('id' => $va['merchantid']), 'storename'); + $va['agentname'] = pdo_getcolumn(PDO_NAME . 'agentusers', array('id' => $va['aid']), 'agentname'); + $va['count'] = $va['count'] - 1; //重复核销次数 + $va['allstoremoney'] = $va['merchantmoney'] * $va['count']; //总的结算给商户的错误金额 + $va['alldismoney'] = $va['distrimoney'] * $va['count'];//总的结算给分销商的错误金额 + $va['allagentmoney'] = $va['agentmoney'] * $va['count'];//总的结算给代理的错误金额 + $va['nowstoremoney'] = pdo_getcolumn(PDO_NAME . 'merchantdata', array('id' => $va['merchantid']), 'nowmoney'); //目前商户的金额 + $va['nowagentmoney'] = pdo_getcolumn(PDO_NAME . 'agentusers', array('id' => $va['aid']), 'nowmoney'); //目前代理的金额 + if ($va['alldismoney'] > 0) { + $checkcode = pdo_get('wlmerchant_smallorder', array('checkcode' => $va['checkcode']), array('plugin', 'oneleadid', 'twoleadid', 'onedismoney', 'twodismoney')); + if ($checkcode['plugin'] == 'coupon') { + $dissettime = pdo_getcolumn(PDO_NAME . 'couponlist', array('id' => $va['goodsid']), 'dissettime'); + } else if ($checkcode['plugin'] == 'wlfightgroup') { + $dissettime = pdo_getcolumn(PDO_NAME . 'fightgroup_goods', array('id' => $va['goodsid']), 'dissettime'); + } else if ($checkcode['plugin'] == 'groupon') { + $dissettime = pdo_getcolumn(PDO_NAME . 'groupon_activity', array('id' => $va['goodsid']), 'dissettime'); + } else if ($checkcode['plugin'] == 'rush') { + $dissettime = pdo_getcolumn(PDO_NAME . 'rush_activity', array('id' => $va['goodsid']), 'dissettime'); + } else if ($checkcode['plugin'] == 'bargain') { + $dissettime = pdo_getcolumn(PDO_NAME . 'bargain_activity', array('id' => $va['goodsid']), 'dissettime'); + } + $va['oneleadid'] = $checkcode['oneleadid']; + $va['twoleadid'] = $checkcode['twoleadid']; + $va['onedisname'] = pdo_getcolumn(PDO_NAME . 'member', array('distributorid' => $checkcode['oneleadid']), 'nickname'); + if ($checkcode['twoleadid'] > 0) { + $va['twodisname'] = pdo_getcolumn(PDO_NAME . 'member', array('distributorid' => $checkcode['twoleadid']), 'nickname'); + } else { + $va['twodisname'] = '无二级分销商'; + } + if ($dissettime) { + $va['alldismoney'] = 0; + $va['oneerrormoney'] = $va['twoerrormoney'] = 0; + $va['onenowmoney'] = $va['twonowmoney'] = 0; + $va['tip'] = '佣金支付时结算,无错误'; + } else { + $va['oneerrormoney'] = $checkcode['onedismoney'] * $va['count']; + $va['twoerrormoney'] = $checkcode['twodismoney'] * $va['count']; + $va['onenowmoney'] = pdo_getcolumn(PDO_NAME . 'distributor', array('id' => $checkcode['oneleadid']), 'nowmoney'); + $va['twonowmoney'] = pdo_getcolumn(PDO_NAME . 'distributor', array('id' => $checkcode['twoleadid']), 'nowmoney'); + } + } else { + $va['alldismoney'] = 0; + $va['oneleadid'] = $va['twoleadid'] = 0; + $va['onedisname'] = $va['twodisname'] = '无'; + $va['oneerrormoney'] = $va['twoerrormoney'] = 0; + $va['onenowmoney'] = $va['twonowmoney'] = 0; + } + $allmoney['allstoremoney'] += $va['allstoremoney']; + $allmoney['alldismoney'] += $va['alldismoney']; + $allmoney['allagentmoney'] += $va['allagentmoney']; + } + } + include wl_template('cloud/settlement_error'); + } + + public function repair_settlement_error() + { + global $_W, $_GPC; + $checkcode = $_GPC['checkcode']; + $commentSql = "select id,checkcode,merchantid,type,orderno,goodsid,goodsid,agentmoney,createtime,merchantmoney,distrimoney,aid,count(id) as count from" . tablename(PDO_NAME . "autosettlement_record") . "WHERE checkcode = '{$checkcode}'"; + $record = pdo_fetch($commentSql); + $record['count'] = $record['count'] - 1; //重复核销次数 + + //修复商户金额 + $record['allstoremoney'] = $record['merchantmoney'] * $record['count']; //总的结算给商户的错误金额 + pdo_fetch("update" . tablename('wlmerchant_merchantdata') . "SET allmoney=allmoney-{$record['allstoremoney']},nowmoney=nowmoney-{$record['allstoremoney']} WHERE id = {$record['merchantid']}"); + $firstsid = pdo_getcolumn(PDO_NAME . 'current', array('remark' => $checkcode, 'status' => 1, 'objid' => $record['merchantid']), 'id'); + pdo_delete(PDO_NAME . 'current', array('id >' => $firstsid, 'remark' => $checkcode, 'status' => 1, 'objid' => $record['merchantid'])); + + + //修复代理金额 + $record['allagentmoney'] = $record['agentmoney'] * $record['count'];//总的结算给代理的错误金额 + pdo_fetch("update" . tablename('wlmerchant_agentusers') . "SET allmoney=allmoney-{$record['allagentmoney']},nowmoney=nowmoney-{$record['allagentmoney']} WHERE id = {$record['aid']}"); + $firstaid = pdo_getcolumn(PDO_NAME . 'current', array('remark' => $checkcode, 'status' => 2, 'objid' => $record['aid']), 'id'); + pdo_delete(PDO_NAME . 'current', array('id >' => $firstaid, 'remark' => $checkcode, 'status' => 2, 'objid' => $record['aid'])); + + + //修复分销金额 + $record['alldismoney'] = $record['distrimoney'] * $record['count'];//总的结算给分销商的错误金额 + if ($record['alldismoney'] > 0) { + $smallorder = pdo_get('wlmerchant_smallorder', array('checkcode' => $record['checkcode']), array('plugin', 'oneleadid', 'twoleadid', 'onedismoney', 'twodismoney')); + if ($smallorder['plugin'] == 'coupon') { + $dissettime = pdo_getcolumn(PDO_NAME . 'couponlist', array('id' => $record['goodsid']), 'dissettime'); + } else if ($smallorder['plugin'] == 'wlfightgroup') { + $dissettime = pdo_getcolumn(PDO_NAME . 'fightgroup_goods', array('id' => $record['goodsid']), 'dissettime'); + } else if ($smallorder['plugin'] == 'groupon') { + $dissettime = pdo_getcolumn(PDO_NAME . 'groupon_activity', array('id' => $record['goodsid']), 'dissettime'); + } else if ($smallorder['plugin'] == 'rush') { + $dissettime = pdo_getcolumn(PDO_NAME . 'rush_activity', array('id' => $record['goodsid']), 'dissettime'); + } else if ($smallorder['plugin'] == 'bargain') { + $dissettime = pdo_getcolumn(PDO_NAME . 'bargain_activity', array('id' => $record['goodsid']), 'dissettime'); + } + if (empty($dissettime)) { + $oneerrormoney = $smallorder['onedismoney'] * $record['count']; + pdo_fetch("update" . tablename('wlmerchant_distributor') . "SET dismoney=dismoney-{$oneerrormoney},nowmoney=nowmoney-{$oneerrormoney} WHERE id = {$smallorder['oneleadid']}"); + $onemid = pdo_getcolumn(PDO_NAME . 'distributor', array('id' => $smallorder['oneleadid']), 'mid'); + $firstoneid = pdo_getcolumn(PDO_NAME . 'disdetail', array('checkcode' => $checkcode, 'leadid' => $onemid), 'id'); + pdo_delete(PDO_NAME . 'disdetail', array('id >' => $firstoneid, 'checkcode' => $checkcode, 'leadid' => $onemid)); + if ($smallorder['twoleadid']) { + $twoerrormoney = $smallorder['twodismoney'] * $record['count']; + pdo_fetch("update" . tablename('wlmerchant_distributor') . "SET dismoney=dismoney-{$twoerrormoney},nowmoney=nowmoney-{$twoerrormoney} WHERE id = {$smallorder['twoleadid']}"); + $twomid = pdo_getcolumn(PDO_NAME . 'distributor', array('id' => $smallorder['twoleadid']), 'mid'); + $firsttwoid = pdo_getcolumn(PDO_NAME . 'disdetail', array('checkcode' => $checkcode, 'leadid' => $twomid), 'id'); + pdo_delete(PDO_NAME . 'disdetail', array('id >' => $firsttwoid, 'checkcode' => $checkcode, 'leadid' => $twomid)); + } + } + } + pdo_delete(PDO_NAME . 'autosettlement_record', array('id >' => $record['id'], 'checkcode' => $checkcode)); + + show_json(1, array('url' => referer())); + } + + public function updateOpenid() + { + global $_W, $_GPC; + $account_api = WeAccount::create(); + $token = $account_api->getAccessToken(); + $url = 'http://api.weixin.qq.com/cgi-bin/changeopenid?access_token=' . $token; + $res = $fail = 0; + for ($page = 0; $page < 10; $page++) { + $sql = "select openid from ims_wlmerchant_member where uniacid = 1 AND openid LIKE '%oR9%' AND changeflag = 0 ORDER BY `id` DESC limit 0,100;"; + $openidlist = pdo_fetchall($sql); + foreach ($openidlist as $row) { + $openid[] = $row['openid']; + } + if (!empty($openid)) { + $data = json_encode(array('from_appid' => 'wxdef947e212d31c82', 'openid_list' => $openid)); + $resarray = ihttp_post($url, $data); + $resarray = json_decode($resarray['content'], true); + $resarray = $resarray['result_list']; + foreach ($resarray as $item) { + if ($item['err_msg'] == 'ok') { + pdo_update('wlmerchant_member', array('openid' => $item['new_openid']), array('openid' => $item['ori_openid'])); + pdo_update('mc_mapping_fans', array('openid' => $item['new_openid']), array('openid' => $item['ori_openid'])); + $res++; + } else { + file_put_contents(PATH_DATA . "error_openid.log", var_export($item, true) . PHP_EOL, FILE_APPEND); + pdo_update('wlmerchant_member', array('changeflag' => 1), array('openid' => $item['ori_openid'])); + $fail++; + } + } + } + } + echo('成功' . $res . '失败' . $fail); + } + + function sendSelfFormatOrderInfo($device_no, $key, $times = 1, $orderInfo) + { // $times打印次数 + $selfMessage = array( + 'deviceNo' => $device_no, + 'printContent' => $orderInfo, + 'key' => $key, + 'times' => $times + ); + $url = "http://open.printcenter.cn:8080/addOrder"; + $options = array( + 'http' => array( + 'header' => "Content-type: application/x-www-form-urlencoded ", + 'method' => 'POST', + 'content' => http_build_query($selfMessage), + ), + ); + $context = stream_context_create($options); + $result = file_get_contents($url, false, $context); + + return $result; + } + + + function test($arr,$A,$B,$C,$D) + { + $orderInfo = '飞鹅云测试
'; + $orderInfo .= '名称 单价 数量 金额
'; + $orderInfo .= '--------------------------------
'; + foreach ($arr as $k5 => $v5) { + $name = $v5['title']; + $price = $v5['price']; + $num = $v5['num']; + $prices = $v5['price']*$v5['num']; + $kw3 = ''; + $kw1 = ''; + $kw2 = ''; + $kw4 = ''; + $str = $name; + $blankNum = $A;//名称控制为14个字节 + $lan = mb_strlen($str,'utf-8'); + $m = 0; + $j=1; + $blankNum++; + $result = array(); + if(strlen($price) < $B){ + $k1 = $B - strlen($price); + for($q=0;$q<$k1;$q++){ + $kw1 .= ' '; + } + $price = $price.$kw1; + } + if(strlen($num) < $C){ + $k2 = $C - strlen($num); + for($q=0;$q<$k2;$q++){ + $kw2 .= ' '; + } + $num = $num.$kw2; + } + if(strlen($prices) < $D){ + $k3 = $D - strlen($prices); + for($q=0;$q<$k3;$q++){ + $kw4 .= ' '; + } + $prices = $prices.$kw4; + } + for ($i=0;$i<$lan;$i++){ + $new = mb_substr($str,$m,$j,'utf-8'); + $j++; + if(mb_strwidth($new,'utf-8')<$blankNum) { + if($m+$j>$lan) { + $m = $m+$j; + $tail = $new; + $lenght = iconv("UTF-8", "GBK//IGNORE", $new); + $k = $A - strlen($lenght); + for($q=0;$q<$k;$q++){ + $kw3 .= ' '; + } + if($m==$j){ + $tail .= $kw3.' '.$price.' '.$num.' '.$prices; + }else{ + $tail .= $kw3.'
'; + } + break; + }else{ + $next_new = mb_substr($str,$m,$j,'utf-8'); + if(mb_strwidth($next_new,'utf-8')<$blankNum) continue; + else{ + $m = $i+1; + $result[] = $new; + $j=1; + } + } + } + } + $head = ''; + foreach ($result as $key=>$value) { + if($key < 1){ + $v_lenght = iconv("UTF-8", "GBK//IGNORE", $value); + $v_lenght = strlen($v_lenght); + if($v_lenght == 13) $value = $value." "; + $head .= $value.' '.$price.' '.$num.' '.$prices; + }else{ + $head .= $value.'
'; + } + } + $orderInfo .= $head.$tail; + @$nums += $prices; + } + $time = date('Y-m-d H:i:s',time()); + $orderInfo .= '--------------------------------
'; + $orderInfo .= '合计:'.number_format($nums, 1).'元
'; + $orderInfo .= '送货地点:广州市南沙区xx路xx号
'; + $orderInfo .= '联系电话:020-39004606
'; + $orderInfo .= '订餐时间:'.$time.'
'; + $orderInfo .= '备注:加辣

'; + $orderInfo .= 'http://www.feieyun.com';//把解析后的二维码生成的字符串用标签套上即可自动生成二维码 + return $orderInfo; + } + + + + public function run() + { + global $_W, $_GPC; + //亿奇达接口 + $time = time(); + $admin = 'weliam'; + $key = 'dccb26ebc60c7923e90506d9c46c4cd7'; + //获取分组信息 + //$sign = md5($time.$key); + //$url = "http://open.yiqida.cn/api/UserCommdity/GetCatalogList?timestamp={$time}&userName={$admin}&sign={$sign}"; + //$yqdInfo = curlPostRequest($url,[]); + + //获取分组商品列表 +// $data = [ +// 'page' => 1, +// 'size' => 60, +// 'catalogId' => 10625 +// ]; +// $data = json_encode($data); +// $sign = md5($time.$data.$key); +// $url = "http://open.yiqida.cn/api/UserCommdity/GetCommodityList?timestamp={$time}&userName={$admin}&sign={$sign}"; +// $yqdInfo = curlPostRequest($url,$data); + + //获取商品信息 +// $data = [ +// 'id' => 30181 +// ]; +// $data = json_encode($data); +// $sign = md5($time.$data.$key); +// $url = "http://open.yiqida.cn/api/UserCommdity/GetCommodityInfo?timestamp={$time}&userName={$admin}&sign={$sign}"; +// $yqdInfo = curlPostRequest($url,$data); + + //订单提交 +// $template = [urlencode('13658059596')]; +// $callurl = $_W['siteroot'].'addons/'.MODULE_NAME.'/plugin/pftapimod/yqdAsyNotify.php'; +// $orderno = 'wl_'.'2022030310300900013918966342'; +// $data = [ +// 'commodityId' => 30230, +// 'external_orderno' => $orderno, +// 'buyCount' => 1, +// 'remark' => 'okok', +// 'callbackUrl' => $callurl, +// 'externalSellPrice' => 3, +// 'template' => $template +// ]; +// +// $data = json_encode($data); +// $sign = md5($time.$data.$key); +// $url = "http://open.yiqida.cn/api/UserOrder/CreateOrder?timestamp={$time}&userName={$admin}&sign={$sign}"; + //$yqdInfo = curlPostRequest($url,$data); + //wl_debug($yqdInfo); + + + + //飞鹅测试 +// $keyword = '株洲县'; +// $city_name = '株洲市'; +// $res = MapService::guide_search($keyword , "region(" . urlencode($city_name) . ",0)"); +// wl_debug($res); +// $url = 'http://api.feieyun.cn/Api/Open/'; +// $user = '937991452@qq.com'; +// $ukey = '4k9xB8eE6QDvV3b3'; +// $SN = '917508610'; +// $time = time(); +// $sig = sha1($user.$ukey.$time); +// +// $arr[] = [ +// 'title' => '苹果', +// 'price' => 10, +// 'num' => 5 +// ]; +// +// $arr[] = [ +// 'title' => '梨子', +// 'price' => 5, +// 'num' => 3 +// ]; +// +// $arr[] = [ +// 'title' => '橘子', +// 'price' => 6, +// 'num' => 4 +// ]; +// $content = $this->test($arr,14,6,3,6);//名称14 单价6 数量3 金额6-->这里的字节数可按自己需求自由改写,14+6+3+6再加上代码写的3个空格就是32了,58mm打印机一行总占32字节 +// +// $data = [ +// 'user' => $user, +// 'stime' => $time, +// 'sig' => $sig, +// 'apiname' => 'Open_printMsg', +// 'debug' => 1, +// 'sn' => $SN, +// 'content' => $content +// ]; +// +// +// $dadaInfo = curlPostRequest($url,$data); +// wl_debug($dadaInfo); + + + + +// $res = Pftapimod::getTicketDetail(298611,1200053); +// wl_debug($res); + //36鲸接口测试 +// $jnumber = '30000451'; +// $appkey = 'OWFtzFJjCtt0kIf_kqusxpX6tylsN4ON'; +// $admin = 'http://81.69.6.74:9099'; +// +// //下单 +// $sloworderurl = '/v1/mobile/sloworder'; +// $posturl = $admin.$sloworderurl; +// +// $data = [ +// 'appKey' => $jnumber, +// 'orderId' => '2021110114372400013969664264', +// 'mobile' => '13658059596', +// 'amount' => 5.12, +// 'notifyUrl' => $_W['siteroot'].'addons/'.MODULE_NAME.'/plugin/pftapimod/pftAsyNotify.php' +// ]; +// +// //签名 +// ksort($data); +// $arr = []; +// foreach ($data as $key => $value) { +// $arr[] = $key.'='.$value; +// } +// +// $arr[] = 'key='.$appkey; +// $str = implode('&', $arr); +// $str = strtoupper(md5($str)); +// $data['sign'] = $str; +// +// $Info = curlPostRequest($posturl,$data); +// wl_debug($Info); + + + +// $orders = pdo_getall('wlmerchant_smallorder',array('status' => 2,'dissettletime'=> 0,'disorderid >'=>0,'settletime >' => 1634608805)); +// wl_debug($orders); +// foreach ($orders as $order){ +// if($order['disorderid']){ +// $disorder = pdo_get('wlmerchant_disorder',array('id' => $order['disorderid'])); +// $nosetflag = pdo_getcolumn('wlmerchant_disdetail',array('checkcode' => $order['checkcode'],'status'=>0),'id'); +// if(empty($nosetflag)){ +// if($order['onedismoney'] > 0){ +// $oneres = pdo_query("update" . tablename('wlmerchant_distributor') . "SET dismoney=dismoney+{$order['onedismoney']},nowmoney=nowmoney+{$order['onedismoney']} WHERE id = {$order['oneleadid']}"); +// if($oneres){ +// $leadid = pdo_getcolumn('wlmerchant_distributor',array('id'=> $order['oneleadid']),'mid'); +// $onenowmoney = pdo_getcolumn(PDO_NAME.'distributor',array('id'=> $order['oneleadid']),'nowmoney'); +// Distribution::adddisdetail($order['disorderid'],$leadid,$disorder['buymid'],1,$order['onedismoney'],$disorder['plugin'],1,'分销订单结算',$onenowmoney,$order['checkcode'],0,$order['aid']); +// } +// } +// if($order['twodismoney'] > 0){ +// $twores = pdo_query("update" . tablename('wlmerchant_distributor') . "SET dismoney=dismoney+{$order['twodismoney']},nowmoney=nowmoney+{$order['twodismoney']} WHERE id = {$order['twoleadid']}"); +// if($twores){ +// $leadid = pdo_getcolumn('wlmerchant_distributor',array('id'=> $order['twoleadid']),'mid'); +// $twonowmoney = pdo_getcolumn(PDO_NAME.'distributor',array('id'=> $order['twoleadid']),'nowmoney'); +// Distribution::adddisdetail($order['disorderid'],$leadid,$disorder['buymid'],1,$order['twodismoney'],$disorder['plugin'],2,'分销订单结算',$twonowmoney,$order['checkcode'],0,$order['aid']); +// } +// } +// $sdata['dissettletime'] = time(); +// } +// } +// pdo_update('wlmerchant_smallorder',$sdata,array('id' => $order['id'])); +// } + +// $merchantNo = '94734160742A3RD'; +// $terminalNo = '72002165'; +// $key = '3B3B79F217DD9705DEE9EF3C496B6134'; +// //签到接口调试 +// //退款 +// $url = 'https://wxtest2.ahrcu.com:3443/cposp/pay/refund'; +// $data['merchantNo'] = $merchantNo; +// $data['terminalNo'] = $terminalNo; +// $yun_signIn = Payment::yunSignIn($merchantNo,$terminalNo); +// $data['batchNo'] = $yun_signIn['batchNo']; +// $data['traceNo'] = $yun_signIn['traceNo']; +// $data['itpOrderId'] = '11002021072378214482'; +// $data['nonceStr'] = random(16); +// $data['refundAmount'] = 2; +// $data['mchtRefundNo'] = 'R'.rand(0,9).'2021072318584100001842462671'; +// $data['sign'] = Payment::getYunSign($data,$key); +// $data = json_encode($data); +// $res = curlPostRequest($url,$data,["Content-type: application/json;charset='utf-8'"]); +// wl_debug($res); +// +// //退款查询 +// $url = 'https://wxtest2.ahrcu.com:3443/cposp/pay/refundQuery'; +// $data['merchantNo'] = $merchantNo; +// $data['terminalNo'] = $terminalNo; +// $yun_signIn = Payment::yunSignIn($merchantNo,$terminalNo); +// $data['batchNo'] = $yun_signIn['batchNo']; +// $data['traceNo'] = $yun_signIn['traceNo']; +// $data['itpOrderId'] = '11002021072378214482'; +// $data['nonceStr'] = random(16); +// +// $data['sign'] = Payment::getYunSign($data,$key); +// $data = json_encode($data); +// $res = curlPostRequest($url,$data,["Content-type: application/json;charset='utf-8'"]); +// wl_debug($res); + + + + + + + //查询零点用户数据/导入 +// $users = pdo_fetchall("SELECT session_key,user_id as zeroid,open_id as wechat_openid,nickName as nickname,avatarUrl as avatar,mobile FROM ".tablename('weliam_user')."WHERE wxapp_id = 3 ORDER BY user_id DESC limit 500"); +// foreach ($users as $rrr){ +// $rrr['isvip'] = 1; +// $rrr['createtime'] =time(); +// $rrr['dotime'] =time(); +// $rrr['tokey'] = strtoupper(MD5(sha1(time() . random(12)))); +// $rrr['uniacid'] = 1; +// $res = pdo_insert('wlmerchant_member', $rrr); +// if($res){ +// pdo_update('weliam_user',array('wxapp_id' => 300),array('user_id' => $rrr['zeroid'])); +// } +// } + + //查询零点分销数据/导入 + // $users = pdo_fetchall("SELECT user_id as zeroid,create_time as createtime,update_time as updatetime,real_name as realname FROM ".tablename('weliam_dealer_user')."WHERE wxapp_id = 3 ORDER BY user_id DESC"); + + // foreach ($users as &$us){ + // $us['uniacid'] = 1; + // $member = pdo_get('wlmerchant_member',array('zeroid' => $us['zeroid']),array('nickname','id','mobile')); + // $us['disflag'] = 1; + // $us['mid'] = $member['id']; + // $us['nickname'] = $member['nickname']; + // $us['mobile'] = $member['mobile']; + // pdo_insert('wlmerchant_distributor', $us); + // } + // wl_debug($users); + + + //插入关系表 +// $users = pdo_fetchall("SELECT dealer_id,user_id,create_time,id FROM ".tablename('weliam_dealer_referee')."WHERE wxapp_id = 3 ORDER BY user_id DESC limit 300"); +// foreach ($users as $ues){ +// $dis = pdo_getcolumn('wlmerchant_distributor',array('zeroid' => $ues['user_id']),'id'); +// wl_debug($dis); +// if($dis > 0){ +// $leadid = pdo_getcolumn('wlmerchant_member',array('zeroid' => $ues['dealer_id']),'id'); +// pdo_update('wlmerchant_distributor',array('leadid' => $leadid),array('id' => $dis)); +// }else{ +// $leadid = pdo_getcolumn('wlmerchant_member',array('zeroid' => $ues['dealer_id']),'id'); +// $member = pdo_get('wlmerchant_member',array('zeroid' => $ues['user_id']),array('mobile','nickname','realname','id',)); +// $data = [ +// 'uniacid' => 1, +// 'mid' => $member['id'], +// 'leadid' => $leadid, +// 'nickname' => $member['nickname'], +// 'realname' => $member['realname'], +// 'mobile' => $member['mobile'], +// 'createtime' => time() +// ]; +// pdo_insert('wlmerchant_distributor',$data); +// } +// pdo_update('weliam_dealer_referee',array('wxapp_id' => 300),array('id' => $ues['id'])); +// } +// wl_debug($users); +// $users = pdo_fetchall("SELECT id,nickname FROM ".tablename('wlmerchant_member')."WHERE uid = 0 ORDER BY id DESC limit 500"); +// foreach ($users as $uss){ +// $uid = Member::createUserInfo($uss['nickname']); +// pdo_update('wlmerchant_member',array('uid' => $uid),array('id' => $uss['id'])); +// } + + + +// $info = [ +// 'type' => 2 ,//支付方式 +// 'tid' => '2021042720491900009167214842' ,//订单号 +// 'transaction_id' => '4200001036202104275279675636', +// 'time' => '20210427204920', +// 'pay_order_no' => '2021042720491900009167214842', +// 'bank_type' => 'OTHERS', +// ]; +// PayResult::main($info);//调用方法处理订单 + +// $order = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_order')."WHERE orderno = 'undefined' ORDER BY id DESC"); +// foreach($order as $or){ +// $moduleid = pdo_getcolumn("modules", array('name' => 'weliam_smartcity'), 'mid'); +// $moduleid = empty($moduleid) ? '000000' : sprintf("%06d", $moduleid); +// $uniontid = date('YmdHis',$or['createtime']) . $moduleid . random(8, 1); +// pdo_update('wlmerchant_order',array('orderno' => $uniontid),array('id' => $or['id'])); +// pdo_update('wlmerchant_delivery_order',array('tid' => $uniontid),array('orderid' => $or['id'])); +// } + +// $weixin = NEW WeixinPay(); +// $res = $weixin->allocationMulti(6717,1,'',0); +// wl_debug($res); + //分销商重复数据 +// $commentSql = "select mid,count(*) as count from" . tablename(PDO_NAME . "distributor") . "group by mid having count > 1 AND mid > 0"; +// $comment = pdo_fetchall($commentSql); +// wl_debug($comment); +// foreach ($comment as $com){ +// $member = pdo_get('wlmerchant_member',array('id' => $com['mid']),array('distributorid')); +// pdo_delete('wlmerchant_distributor',array('mid'=>$com['mid'],'id !=' => $member['distributorid'],'nowmoney <'=> '0.01')); +// } + +// $commentSql = "select checkcode,count(*) as count from".tablename(PDO_NAME."autosettlement_record")."group by checkcode having count > 1 AND checkcode > 0 "; +// $comment = pdo_fetchall($commentSql); +// foreach ($comment as $com){ +// $list = pdo_fetchall("SELECT * FROM ".tablename(PDO_NAME.'autosettlement_record')."WHERE checkcode = {$com['checkcode']} ORDER BY id DESC"); +// $num = count($list) - 1; +// for ($i=0;$i<$num;$i++){ +// if($list[$i]['merchantmoney']>0){ +// pdo_fetch("update" . tablename('wlmerchant_merchantdata') . "SET allmoney=allmoney-{$list[$i]['merchantmoney']},nowmoney=nowmoney-{$list[$i]['merchantmoney']} WHERE id = {$list[$i]['merchantid']}"); +// } +// if($list[$i]['agentmoney']>0){ +// pdo_fetch("update" . tablename('wlmerchant_agentusers') . "SET allmoney=allmoney+{$list[$i]['agentmoney']},nowmoney=nowmoney+{$list[$i]['agentmoney']} WHERE id = {$list[$i]['aid']}"); +// } +// pdo_delete('wlmerchant_autosettlement_record',array('id'=>$list[$i]['id'])); +// } +// } +// $commentSql = "SELECT a.id,a.mid,a.uniacid FROM ". tablename(PDO_NAME."distributor") +// ." as a LEFT JOIN ".tablename(PDO_NAME."member") +// ." as b ON a.mid = b.id WHERE +// CASE +// WHEN a.uniacid != b.uniacid THEN 1 +// ELSE 0 +// END = 1 ORDER BY id DESC"; +// $comment = pdo_fetchall($commentSql); +// wl_debug($comment); +// foreach ($comment as $com){ +// $uniacid = pdo_getcolumn(PDO_NAME.'member',array('id'=>$com['mid']),'uniacid'); +// pdo_update(PDO_NAME."distributor",array('uniacid' => $uniacid),array('id' => $com['id'])); +// } +// set_time_limit(0); +// $times = pdo_fetchall("SELECT id,merchantid,aid FROM ".tablename('wlmerchant_timecardrecord')."WHERE createtime > 1559318400"); +// foreach ($times as $key => $time){ +// $aid = pdo_getcolumn(PDO_NAME.'merchantdata',array('id'=>$time['merchantid']),'aid'); +// if($aid!=$time['aid']){ +// pdo_update('wlmerchant_timecardrecord',array('aid' => $aid),array('id' => $time['id'])); +// } +// } + +// $success = 0; +// $current = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_current')."WHERE status = 2 AND type = 1 AND fee > 0 ORDER BY id DESC"); +// foreach ($current as $key => $curr) { +// $order = pdo_get('wlmerchant_rush_order',array('id' => $curr['orderid']),array('aid')); +// if($order['aid'] != $curr['aid']){ +// $curr['taid'] = $order['aid']; +// $res1 = pdo_update('wlmerchant_agentusers', array('allmoney -=' => $curr['fee'],'nowmoney -=' => $curr['fee']), array('id' =>$curr['aid'])); +// $res2 = pdo_update('wlmerchant_agentusers', array('allmoney +=' => $curr['fee'],'nowmoney +=' => $curr['fee']), array('id' =>$curr['taid'])); +// if($res1 && $res2){ +// $res3 = pdo_delete('wlmerchant_current',array('id'=>$curr['id'])); +// $success ++; +// } +// if($res3){ +// $nowmoney = pdo_getcolumn(PDO_NAME.'agentusers',array('id'=>$curr['taid']),'nowmoney'); +// $data = array( +// 'uniacid' => $curr['uniacid'], +// 'status' => 2, +// 'type' => 1, +// 'objid' => $curr['taid'], +// 'fee' => $curr['fee'], +// 'nowmoney' => $nowmoney, +// 'orderid' => $curr['orderid'], +// 'remark' => '错误结算到其他代理,重结算', +// 'createtime' => time(), +// 'aid' => $curr['taid'], +// ); +// pdo_insert(PDO_NAME.'current',$data); +// } +// } +// } +// wl_debug($success); + + + if (checksubmit()) { + $sql = $_POST['sql']; + pdo_run($sql); + wl_message('查询执行成功.', 'refresh'); + } + include wl_template('cloud/database'); + } + + public function data_fix() + { + global $_W, $_GPC; + wl_debug($_GPC); + +// $fix_orders = []; +// $orders = pdo_getall('wlmerchant_smallorder', array('uniacid' => 141, 'twoleadid !=' => 0, 'status' => 1), ['orderno', 'orderid', 'oneleadid', 'twoleadid', 'checkcode']); +// foreach ($orders as $order) { +// $distor = pdo_get('wlmerchant_distributor', ['id' => $order['twoleadid']], ['leadid']); +// if ($order['oneleadid'] != $distor['leadid']) { +// $order['one'] = $distor['leadid']; +// $fix_orders[$order['orderid']][] = $order; +// } +// } +// wl_debug(['data' => $fix_orders, 'count' => count($fix_orders)]); + //Order::createSmallorder(62704,1); + } + + public function upgrade() + { + global $_W, $_GPC; + $tables = []; + $tablenames = WeliamDb::get_tables_name('wlmerchant', $_W['config']['db']['tablepre']); + foreach ($tablenames as $tablename) { + $tableinfo = WeliamDb::get_table_schema($tablename); + $tables[] = $tableinfo; + } + wl_debug($tables); + } + + public function upgrade_file() + { + global $_W; + $tables = []; + $tablenames = WeliamDb::get_tables_name($_W['config']['db']['tablepre'], $_W['config']['db']['tablepre']); + foreach ($tablenames as $tablename) { + $tables[] = WeliamDb::get_table_schema($tablename); + } + file_put_contents(PATH_CORE . "common/dbfile.php", base64_encode(json_encode($tables))); + if(IMS_FAMILY == 'wl'){ + $lct = 'wl'; + }else{ + $lct = 0; + } + wl_message('数据更新文件生成成功', web_url('cloud/database/datemana',['lct'=> $lct]), 'success'); + + } + + public function datemana() + { + global $_W, $_GPC; + include wl_template('cloud/datemana'); + } + + public function areadata() + { + global $_W, $_GPC, $GLOBALS; + if(IMS_FAMILY == 'wl'){ + $lct = 'wl'; + }else{ + $lct = 0; + } + $type = !empty($_GPC['type']) ? $_GPC['type'] : 'install'; + if ($type == 'install') { + $this->areadatainit(); + wl_message('地区数据安装成功.', web_url('cloud/database/datemana',['lct'=> $lct]), 'success'); + } + if ($type == 'clear') { + $id = pdo_getcolumn(PDO_NAME . 'area', array('id' => 110000), 'id'); + if (empty($id)) { + wl_message('不存在地区数据,无需再清除.', web_url('cloud/database/datemana',['lct'=> $lct]), 'warning'); + } + pdo_query("TRUNCATE TABLE " . tablename('wlmerchant_area') . ";"); + wl_message('地区数据清除成功.', web_url('cloud/database/datemana',['lct'=> $lct]), 'success'); + } + } + + public function areadataup() + { + $t1 = microtime(true); + ini_set('display_errors', '1'); + error_reporting(E_ALL ^ E_NOTICE); + $this->areadatainit(); + $t2 = microtime(true); + wl_debug('执行完成,耗时' . round($t2 - $t1, 3) . '秒'); + } + + public function permission() + { + if(IMS_FAMILY == 'wl'){ + $lct = 'wl'; + }else{ + $lct = 0; + } + $permission_file = IA_ROOT . '/web/common/permission.inc.php'; + $permission = require $permission_file; + if (!in_array('file', $permission['utility']['direct'])) { + $permission['utility']['direct'][] = 'file'; + $permission_str = var_export($permission, true); + $verdat = << $lct]), 'success'); + } + + /** + * 迁移公众号数据 + */ + public function movedata() + { + global $_W, $_GPC; + if(IMS_FAMILY == 'wl'){ + $lct = 'wl'; + }else{ + $lct = 0; + } + if (checksubmit('submit')) { + $from = intval($_GPC['from']); + $to = intval($_GPC['to']); + if (empty($from) || empty($to)) { + wl_message('请填写公众号ID', referer(), 'warning'); + } + + $tablenames = pdo_fetchall("SHOW TABLES LIKE :tablename", array(":tablename" => "%wlmerchant%")); + foreach ($tablenames as $tablename) { + $table = str_replace($_W['config']['db']['tablepre'], '', end($tablename)); + pdo_update($table, array('uniacid' => $to), array('uniacid' => $from)); + } + wl_message('数据迁移成功.', web_url('cloud/database/movedata',['lct'=> $lct]), 'success'); + } + include wl_template('cloud/movedata'); + } + + public function backup() + { + global $_W, $_GPC; + if(IMS_FAMILY == 'wl'){ + $lct = 'wl'; + }else{ + $lct = 0; + } + load()->func('db'); + if ($_GPC['status']) { + $sql = "SHOW TABLE STATUS LIKE '{$_W['config']['db']['tablepre']}wlmerchant_%'"; + $tables = pdo_fetchall($sql); + if (empty($tables)) { + itoast('数据已经备份完成', web_url('cloud/database/datemana',['lct'=> $lct]), 'success'); + } + $series = max(1, intval($_GPC['series'])); + $volume_suffix = md5(complex_authkey()); + if (!empty($_GPC['folder_suffix']) && !preg_match('/[^0-9A-Za-z-_]/', $_GPC['folder_suffix'])) { + $folder_suffix = $_GPC['folder_suffix']; + } else { + $folder_suffix = TIMESTAMP . '_' . random(8); + } + $bakdir = IA_ROOT . '/data/' . MODULE_NAME . '/backup/' . $folder_suffix; + if (trim($_GPC['start'])) { + $result = mkdirs($bakdir); + } + $size = 300; + $volumn = 1024 * 1024 * 2; + $dump = ''; + if (empty($_GPC['last_table'])) { + $last_table = ''; + $catch = true; + } else { + $last_table = $_GPC['last_table']; + $catch = false; + } + foreach ($tables as $table) { + $table = array_shift($table); + if (!empty($last_table) && $table == $last_table) { + $catch = true; + } + if (!$catch) { + continue; + } + if (!empty($dump)) { + $dump .= "\n\n"; + } + if ($table != $last_table) { + $row = db_table_schemas($table); + $dump .= $row; + } + $index = 0; + if (!empty($_GPC['index'])) { + $index = intval($_GPC['index']); + $_GPC['index'] = 0; + } + while (true) { + $start = $index * $size; + $result = WeliamDb::get_table_insert_sql($table, $_W['uniacid'], $start, $size); + if (!empty($result)) { + $dump .= $result['data']; + if (strlen($dump) > $volumn) { + $bakfile = $bakdir . "/volume-{$volume_suffix}-{$series}.sql"; + $dump .= "\n\n"; + file_put_contents($bakfile, $dump); + ++$series; + ++$index; + $current = array( + 'last_table' => $table, + 'index' => $index, + 'series' => $series, + 'folder_suffix' => $folder_suffix, + 'status' => 1, + ); + $current_series = $series - 1; + message('正在导出数据, 请不要关闭浏览器, 当前第 ' . $current_series . ' 卷.', web_url('cloud/database/backup/', $current), 'info'); + } + } + if (empty($result) || count($result['result']) < $size) { + break; + } + ++$index; + } + } + $bakfile = $bakdir . "/volume-{$volume_suffix}-{$series}.sql"; + $dump .= "\n\n----Weliam MySQL Dump End"; + file_put_contents($bakfile, $dump); + itoast('数据已经备份完成', web_url('cloud/database/datemana',['lct'=> $lct]), 'success'); + } + } + + + private function areadatainit() + { + $address = json_decode(file_get_contents(PATH_WEB . 'resource/download/aliarea.json'), true); + $locations = json_decode(file_get_contents(PATH_WEB . 'resource/download/locations.json'), true); + + foreach ($address['children'] as $province) { + $province['divisionLevel'] == 2 && $this->aliareainsert($province, $locations); + + foreach ($province['children'] as $city) { + if ($city['divisionLevel'] == 4) { + $city['divisionLevel'] = 3; + } + $this->aliareainsert($city, $locations); + if ($city['divisionCode'] != $city['divisionId'] && $city['divisionLevel'] == 3) { + $errnoarray[] = $city; + } + if (!empty($city['children'])) { + foreach ($city['children'] as $district) { + $district['divisionLevel'] == 4 && $this->aliareainsert($district, $locations); + } + } + } + } + foreach ($errnoarray as $errcity) { + pdo_update('wlmerchant_area', array('pid' => $errcity['divisionCode']), array('pid' => $errcity['divisionId'])); + } + } + + private function aliareainsert($item, $location) + { + $name = pdo_getcolumn('wlmerchant_area', array('id' => $item['divisionCode']), 'name'); + $data = array( + 'id' => $item['divisionCode'], + 'pid' => $item['parentId'] == 1 ? 0 : $item['parentId'], + 'name' => $item['divisionName'], + 'visible' => 2, + 'level' => $item['divisionLevel'] - 1, + 'lat' => $location[$item['divisionCode']]['lat'], + 'lng' => $location[$item['divisionCode']]['lng'], + 'pinyin' => $item['pinyin'] ? str_replace(' ', '', $item['pinyin']) : '', + 'initial' => $item['pinyin'] ? strtoupper(substr($item['pinyin'], 0, 1)) : '' + ); + if (empty($name)) { + pdo_insert('wlmerchant_area', $data); + } else { + pdo_update('wlmerchant_area', $data, array('id' => $item['divisionCode'])); + } + } +} diff --git a/addons/weliam_smartcity/sys/controller/cloud/plugin.ctrl.php b/addons/weliam_smartcity/sys/controller/cloud/plugin.ctrl.php new file mode 100644 index 0000000..1062813 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/cloud/plugin.ctrl.php @@ -0,0 +1,111 @@ + $v) { + $status = 0; + if (!empty($statuss) && in_array($v, $statuss)) { + $status = 1; + } + + $data = array("title" => trim($_GPC["titles"][$k]), "ability" => trim($_GPC["abilitys"][$k]), "status" => $status, "displayorder" => intval($_GPC["displayorders"][$k])); + if (!empty($_GPC["pluginimgs"][$k])) { + $data["thumb"] = $_GPC["pluginimgs"][$k]; + } + + pdo_update("wlmerchant_plugin", $data, array("id" => intval($v))); + } + } + show_json(1, '修改成功'); + } + + App::getPlugins(3); + $condition = " where 1 "; + $type = trim($_GPC["type"]); + if (!empty($type)) { + $condition .= " and type = :type"; + $params[":type"] = $type; + } + + $keyword = trim($_GPC["keyword"]); + if (!empty($keyword)) { + $condition .= " and (name like :keyword or title like :keyword)"; + $params[":keyword"] = "%" . $keyword . "%"; + } + + $plugins = pdo_fetchall("select * from " . tablename("wlmerchant_plugin") . $condition, $params); + $types = App::getCategory(); + + include wl_template('cloud/plugin'); + } + + public function return_plugin() { + global $_W; + pdo_query("TRUNCATE TABLE " . tablename('wlmerchant_plugin') . ";"); + show_json(1, array('url' => web_url('cloud/plugin/index'))); + } + + public function account_list() { + global $_W, $_GPC; + $condition = " where 1"; + $keyword = trim($_GPC["keyword"]); + if (!empty($keyword)) { + $condition .= " and b.name like :keyword"; + $params[":keyword"] = "%" . $keyword . "%"; + } + + $pindex = max(1, intval($_GPC["page"])); + $psize = 20; + $total = pdo_fetchcolumn("select count(*) from " . tablename("wlmerchant_perm_account") . " as a left join " . tablename("account_wechats") . " as b on a.uniacid = b.uniacid " . $condition, $params); + $accounts = pdo_fetchall("select a.*, b.name from " . tablename("wlmerchant_perm_account") . " as a left join " . tablename("account_wechats") . " as b on a.uniacid = b.uniacid " . $condition . " LIMIT " . ($pindex - 1) * $psize . "," . $psize, $params); + if (!empty($accounts)) { + foreach ($accounts as &$row) { + $row["plugins"] = iunserializer($row["plugins"]); + } + } + + $pager = wl_pagination($total, $pindex, $psize); + $plugins = App::getPlugins(); + + include wl_template('cloud/account'); + } + + public function account_post() { + global $_W, $_GPC; + $uniacid = intval($_GPC["uniacid"]); + $perm = App::get_account_perm("", $uniacid); + + if ($_W["ispost"]) { + if (empty($uniacid)) { + show_json(-1, '请先选择公众号'); + } + + $data = array("uniacid" => $uniacid, "plugins" => iserializer($_GPC["plugins"])); + if (empty($perm["id"])) { + pdo_insert("wlmerchant_perm_account", $data); + } else { + pdo_update("wlmerchant_perm_account", $data, array("id" => $perm["id"])); + } + show_json(1, array('message'=>'编辑公众号权限成功','url'=>web_url("cloud/plugin/account_list", array("uniacid" => $uniacid,'lct'=> $_GPC['lct'])))); + } + + $plugins = App::getPlugins(); + $all_wechats = pdo_fetchall("select a.uniacid, b.name from " . tablename("account") . " as a left join " . tablename("account_wechats") . " as b on a.uniacid = b.uniacid WHERE a.isdeleted = 0 AND a.type = 1 "); + + include wl_template('cloud/account'); + } + + public function account_del() { + global $_W, $_GPC; + $id = intval($_GPC["id"]); + pdo_delete("wlmerchant_perm_account", array("id" => $id)); + show_json(1, '删除公众号权限成功'); + } + +} diff --git a/addons/weliam_smartcity/sys/controller/cloud/wlsysset.ctrl.php b/addons/weliam_smartcity/sys/controller/cloud/wlsysset.ctrl.php new file mode 100644 index 0000000..606081c --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/cloud/wlsysset.ctrl.php @@ -0,0 +1,85 @@ + MODULE_NAME.':task:status'),'value')); + } + if(empty($lock)){ + $status = 1; + }else if($lock['expire'] < (time() - 600 )){ + $status = 3; + }else{ + $status = 2; + } + $all_wechats = pdo_fetchall("select a.uniacid, b.name from " . tablename("account") . " as a left join " . tablename("account_wechats") . " as b on a.uniacid = b.uniacid WHERE a.isdeleted = 0 AND a.type = 1 "); + if (checksubmit('submit')) { + $passiveid = $_GPC['passiveid']; + if(!empty($passiveid)){ + $passiveid = serialize($passiveid); + } + $base['passiveid'] = $passiveid; + Cloud::wl_syssetting_save($base,'taskcover'); + wl_message('操作完成', 'referer', 'success'); + } + include wl_template('cloud/taskcover'); + } + + function base(){ + global $_W,$_GPC; + if(IMS_FAMILY == 'wl'){ + $lct = 'wl'; + }else{ + $lct = 0; + } + $settings = Cloud::wl_syssetting_read('base'); + if (checksubmit('submit')) { + $base = array( + 'name'=>$_GPC['name'], + 'logo'=>$_GPC['logo'], + 'copyright'=>$_GPC['copyright'] + ); + Cloud::wl_syssetting_save($base, 'base'); + wl_message('更新设置成功!', web_url('cloud/wlsysset/base',['lct'=> $lct])); + } + include wl_template('cloud/base'); + } + + function jumpadmin(){ + global $_W,$_GPC; + if(IMS_FAMILY == 'wl'){ + $lct = 'wl'; + }else{ + $lct = 0; + } + $settings = Cloud::wl_syssetting_read('jumpadmin'); + if (checksubmit('submit')) { + $base = array( + 'targetDmain'=>$_GPC['targetDmain'], + 'endDmain'=>$_GPC['endDmain'] + ); + Cloud::wl_syssetting_save($base, 'jumpadmin'); + wl_message('更新设置成功!', web_url('cloud/wlsysset/jumpadmin',['lct'=> $lct])); + } + include wl_template('cloud/jumpadmin'); + } + + function restartqueen(){ + global $_W,$_GPC; + $queue = new Queue; + $queue -> deleteLock(); + show_json(1); + } + +} diff --git a/addons/weliam_smartcity/sys/controller/datacenter/datacenter.ctrl.php b/addons/weliam_smartcity/sys/controller/datacenter/datacenter.ctrl.php new file mode 100644 index 0000000..da5b401 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/datacenter/datacenter.ctrl.php @@ -0,0 +1,666 @@ + $_W['uniacid']), array('id', 'agentname')); + } + $store_where = is_agent() ? array('uniacid' => $_W['uniacid'], 'aid' => $_W['aid'], 'enabled' => 1) : array('uniacid' => $_W['uniacid'], 'enabled' => 1); + $stores = pdo_getall('wlmerchant_merchantdata', $store_where, array('id', 'storename')); + + $condition = is_agent() ? "WHERE uniacid = {$_W['uniacid']} AND aid = {$_W['aid']}" : "WHERE uniacid = {$_W['uniacid']}"; + if(is_store()){ + $sid = $_W['storeid']; + $condition .= " AND sid = {$sid} "; + } + //时间 + $days = isset($_GPC['days']) ? intval($_GPC['days']) : 0; + if ($days == -1) { + $starttime = strtotime(trim($_GPC['stat_day']['start'])); + $endtime = strtotime(trim($_GPC['stat_day']['end'])); + $lenth = ceil((time() - $starttime) / 86400); + $i = ceil((time() - $endtime) / 86400); + $lenth = $lenth - $i + 1; + } else { + $todaytime = strtotime(date('Y-m-d')); + $starttime = strtotime("-{$days} days", $todaytime); + $endtime = $todaytime + 86399; + $lenth = $days + 1; + $i = 0; + } + + $selstarttime = date('Y-m-d', $starttime); + $selendtime = date('Y-m-d', $endtime); + + if (intval($_GPC['agentid']) && $_GPC['type'] == 2) { + $aid = intval($_GPC['agentid']); + if($aid == -1){ + $aid = 0; + } + $condition .= " AND aid = {$aid} "; + } + + if (intval($_GPC['sid']) && $_GPC['type'] == 1) { + $sid = intval($_GPC['sid']); + $condition .= " AND sid = {$sid} "; + } + + $daycon = $condition; + $condition .= " AND paytime > {$starttime} AND paytime < {$endtime}"; + if ($_W['isajax']) { + //营业总额 + $rushmoney = pdo_fetchcolumn('SELECT SUM(actualprice) FROM ' . tablename('wlmerchant_rush_order') . $condition); + if (empty($sid)) { + $halfmoney = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_halfcard_record') . $condition); + } else { + $halfmoney = 0; + } + $otherallmoney = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition); + $data['allmoney'] = sprintf("%.2f", $rushmoney + $otherallmoney + $halfmoney); + //支付客户数 + $rushpaymember = pdo_fetchall('SELECT distinct mid FROM ' . tablename('wlmerchant_rush_order') . $condition); + $otherpaymember = pdo_fetchall('SELECT distinct mid FROM ' . tablename('wlmerchant_order') . $condition); + if (empty($sid)) { + $halfpaymember = pdo_fetchall('SELECT distinct mid FROM ' . tablename('wlmerchant_halfcard_record') . $condition); + } else { + $halfpaymember = 0; + } + $data['paymember'] = count($rushpaymember) + count($otherpaymember) + count($halfpaymember); + //有效订单量 + $rushorder = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_rush_order') . $condition . " AND status NOT IN (0,5,6,7)"); + $otherorder = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . $condition . " AND status NOT IN (0,5,6,7)"); + if (empty($sid)) { + $halforder = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_halfcard_record') . $condition . " AND status = 1"); + } else { + $halforder = 0; + } + $data['ordernum'] = $rushorder + $otherorder + $halforder; + $rushyxmoney = pdo_fetchcolumn('SELECT SUM(actualprice) FROM ' . tablename('wlmerchant_rush_order') . $condition . " AND status NOT IN (0,5,6,7)"); + $otheryxmoney = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND status NOT IN (0,5,6,7)"); + if (empty($sid)) { + $halfyxmoney = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_halfcard_record') . $condition . " AND status = 1 "); + } else { + $halfyxmoney = 0; + } + $data['orderyxmoney'] = sprintf("%.2f", $rushyxmoney + $otheryxmoney + $halfyxmoney); + //退款订单量 + $rushreorder = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_rush_order') . $condition . " AND status IN (6,7)"); + $otherreorder = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . $condition . " AND status IN (6,7)"); + $data['reordernum'] = $rushreorder + $otherreorder + $halfreorder; + $rushremoney = pdo_fetchcolumn('SELECT SUM(actualprice) FROM ' . tablename('wlmerchant_rush_order') . $condition . " AND status IN (6,7)"); + $otherremoney = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND status IN (6,7)"); + $data['reordermoney'] = sprintf("%.2f", $rushremoney + $otherremoney); + + if (empty($sid)) { + //一卡通支付金额 + $data['halfmoney'] = $halfmoney; + //掌上信息 + if(p('pocket')){ + $data['pocketmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'pocket'"); + } + //付费入驻 + $data['chargemoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'store'"); + //分销申请 + if(p('distribution')) { + $data['dismoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'distribution'"); + } + //余额充值 + $data['recmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'member'"); + //积分兑换 + if(p('consumption')){ + $data['conmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'consumption'"); + } + //同城名片 + if(p('citycard')){ + $data['citycardmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'citycard'"); + } + + if ($_W['wlsetting']['distribution']['seetstatus'] && is_agent()) { + $data['allmoney'] = sprintf("%.2f", $data['allmoney'] - $data['dismoney']); + $data['dismoney'] = 0; + } + if(is_agent()){ + $data['allmoney'] = sprintf("%.2f", $data['allmoney'] - $data['conmoney']); + $data['conmoney'] = 0; + } + + } + //抢购 + $data['rushmoney'] = $rushmoney; + //拼团 + $data['fightmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'wlfightgroup'"); + //卡券 + $data['couponmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'coupon'"); + //团购 + $data['grouponmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'groupon'"); + //活动 + $data['actmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'activity'"); + //买单 + $data['onlinemoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'halfcard'"); + //砍价 + $data['bargainmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'bargain'"); + //同城配送 + $data['citydeliverymoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'citydelivery'"); + + foreach ($data as $key => &$va) { + if (empty($va)) { + $va = 0; + } + } + die(json_encode($data)); + } + //账单 + + $list = array(); + for ($i; $i < $lenth; $i++) { + $li = array(); + $testday = date('d') - $i; + $teststa = mktime(0, 0, 0, date('m'), $testday, date('Y')); + $testend = mktime(23, 59, 59, date('m'), $testday, date('Y')); + + if (empty($sid)) { + $li['half'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_halfcard_record') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend}"); + $li['chagre'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND plugin = 'store'"); + if(p('distribution')){ + $li['dismoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND plugin = 'distribution'"); + }else{ + $li['dismoney'] = 0; + } + $li['recmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND plugin = 'member'"); + if(p('pocket')){ + $li['pocket'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND plugin = 'pocket'"); + }else{ + $li['pocket'] = 0; + } + if(p('citycard')){ + $li['citycard'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND plugin = 'citycard'"); + }else{ + $li['citycard'] = 0; + } + if(!is_agent() && p('consumption')){ + $li['consumption'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND plugin = 'consumption'"); + }else{ + $li['consumption'] = 0; + } + } + + if ($_W['wlsetting']['distribution']['seetstatus'] && is_agent() && ! is_store() ) { + $li['dismoney'] = 0; + } + + $li['rush'] = pdo_fetchcolumn('SELECT SUM(actualprice) FROM ' . tablename('wlmerchant_rush_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend}"); + $li['fight'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND plugin = 'wlfightgroup'"); + $li['groupon'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND plugin = 'groupon'"); + $li['coupon'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND plugin = 'coupon'"); + $li['activity'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND plugin = 'activity'"); + $li['payonline'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND plugin = 'halfcard'"); + $li['bargain'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND plugin = 'bargain'"); + $li['citydelivery'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND plugin = 'citydelivery'"); + + //退款 + $rushre = pdo_fetchcolumn('SELECT SUM(actualprice) FROM ' . tablename('wlmerchant_rush_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND status IN (6,7)"); + $otherr = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend} AND status IN (6,7)"); + $li['reordermoney'] = sprintf("%.2f", $rushre + $otherr); + //订单 + $rusho = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_rush_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend}"); + $othero = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend}"); + $halfo = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_halfcard_record') . $daycon . " AND paytime > {$teststa} AND paytime < {$testend}"); + $li['ordernum'] = $rusho + $othero + $halfo; + foreach ($li as $key => &$l) { + if (empty($l)) { + $l = 0; + } + } + $li['date'] = date('Y-m-d', $testend); + $li['allmoney'] = sprintf("%.2f", $li['consumption'] + $li['citycard'] + $li['citydelivery'] + $li['bargain'] + $li['half'] + $li['pocket'] + $li['chagre'] + $li['dismoney'] + $li['recmoney'] + $li['rush'] + $li['fight'] + $li['groupon'] + $li['coupon'] + $li['activity'] + $li['payonline']); + $list[] = $li; + } + + foreach ($list as $key => $va) { + foreach ($va as $k => $vv) { + if ($k != 'date' && $k != 'reordermoney' && $k != 'ordernum' && $k != 'allmoney') { + $imgdata = array(); + $imgdata['dates'] = $va['date']; + switch ($k) { + case 'half' : + $imgdata['name'] = '一卡通'; + break; + case 'chagre' : + $imgdata['name'] = '付费入驻'; + break; + case 'dismoney' : + $imgdata['name'] = '分销商申请'; + break; + case 'recmoney' : + $imgdata['name'] = '余额充值'; + break; + case 'consumption' : + $imgdata['name'] = '积分兑换'; + break; + case 'pocket' : + $imgdata['name'] = '掌上信息'; + break; + case 'citycard' : + $imgdata['name'] = '同城名片'; + break; + case 'rush' : + $imgdata['name'] = '抢购'; + break; + case 'fight' : + $imgdata['name'] = '拼团'; + break; + case 'groupon' : + $imgdata['name'] = '团购'; + break; + case 'coupon' : + $imgdata['name'] = '卡券'; + break; + case 'activity' : + $imgdata['name'] = '活动'; + break; + case 'payonline' : + $imgdata['name'] = '买单'; + break; + case 'bargain' : + $imgdata['name'] = '砍价'; + break; + case 'citydelivery' : + $imgdata['name'] = '同城配送'; + break; + default : + $imgdata['name'] = '未知插件'; + break; + } + $imgdata['money'] = (float)$vv; + $imgdatas[] = $imgdata; + } + } + } + + $imgdatas = json_encode($imgdatas); + + include wl_template('datacenter/stat_operate'); + } + + //店铺统计 + public function stat_store() { + global $_W, $_GPC; + $store_where = is_agent() ? array('uniacid' => $_W['uniacid'], 'aid' => $_W['aid'], 'enabled' => 1) : array('uniacid' => $_W['uniacid'], 'enabled' => 1); + $stores = pdo_getall('wlmerchant_merchantdata', $store_where, array('id', 'storename')); + + $condition = is_agent() ? "WHERE uniacid = {$_W['uniacid']} AND aid = {$_W['aid']}" : "WHERE uniacid = {$_W['uniacid']}"; + //时间 + $days = isset($_GPC['days']) ? intval($_GPC['days']) : 0; + if ($days == -1) { + $starttime = strtotime(trim($_GPC['stat_day']['start'])); + $endtime = strtotime(trim($_GPC['stat_day']['end'])); + $lenth = ceil((time() - $starttime) / 86400); + $i = ceil((time() - $endtime) / 86400); + $lenth = $lenth - $i + 1; + } else { + $todaytime = strtotime(date('Y-m-d')); + $starttime = strtotime("-{$days} days", $todaytime); + $endtime = $todaytime + 86399; + $lenth = $days + 1; + $i = 0; + } + + $selstarttime = date('Y-m-d', $starttime); + $selendtime = date('Y-m-d', $endtime); + + $condition .= " AND paytime > {$starttime} AND paytime < {$endtime}"; + + if (intval($_GPC['sid'])) { + $sid = intval($_GPC['sid']); + $condition .= " AND sid = {$sid}"; + } + + $orderby = $_GPC['orderby'] ? $_GPC['orderby'] : 'money'; + + if ($_W['isajax']) { + //总营业额 + $data['rushmoney'] = pdo_fetchcolumn('SELECT SUM(actualprice) FROM ' . tablename('wlmerchant_rush_order') . $condition); + //抢购 + $data['fightmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'wlfightgroup' "); + $data['couponmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'coupon' "); + $data['groupmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'groupon' "); + $data['actmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'activity' "); + $data['paymoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'halfcard' "); + $data['barmoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'bargain' "); + $data['citydeliverymoney'] = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'citydelivery' "); + + //订单量 + $data['rushorder'] = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_rush_order') . $condition); + $data['fightorder'] = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'wlfightgroup' "); + $data['couponorder'] = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'coupon' "); + $data['grouponorder'] = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'groupon' "); + $data['actorder'] = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'activity' "); + $data['payorder'] = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'halfcard' "); + $data['barorder'] = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'bargain' "); + $data['citydeliveryorder'] = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . $condition . " AND plugin = 'citydelivery' "); + + foreach ($data as $key => &$da) { + if (empty($da)) { + $da = 0; + } + } + $data['allmoney'] = sprintf("%.2f", $data['citydeliverymoney'] + $data['rushmoney'] + $data['fightmoney'] + $data['couponmoney'] + $data['groupmoney'] + $data['actmoney'] + $data['paymoney'] + $data['barmoney']); + $data['allorder'] = $data['citydeliveryorder'] + $data['rushorder'] + $data['fightorder'] + $data['couponorder'] + $data['grouponorder'] + $data['actorder'] + $data['payorder'] + $data['barorder']; + + //趋势图和排名 + if (empty($sid)) { + $rushstores = pdo_fetchall('select distinct sid from ' . tablename(PDO_NAME . 'rush_order') . $condition); + $othertores = pdo_fetchall('select distinct sid from ' . tablename(PDO_NAME . 'order') . $condition . " AND plugin != 'store' "); + + $stores = array_merge($rushstores, $othertores); + $storeids = array(); + foreach ($stores as $key => $va) { + if ($va['sid']) { + $storeids[] = $va['sid']; + } + } + $storeids = array_unique($storeids); + + $storelist = array(); + foreach ($storeids as $key => $storeid) { + $store = array(); + $store['name'] = pdo_getcolumn(PDO_NAME . 'merchantdata', array('id' => $storeid), 'storename'); + //营业额 + $rushmoney = pdo_fetchcolumn('SELECT SUM(actualprice) FROM ' . tablename('wlmerchant_rush_order') . $condition . " AND sid = {$storeid}"); + $othermoney = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND sid = {$storeid} AND plugin != 'store' "); + $store['money'] = sprintf("%.2f", $rushmoney + $othermoney); + $store['moneyrate'] = sprintf("%.2f", $store['money'] / $data['allmoney'] * 100); + //订单量 + $rushorder = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_rush_order') . $condition . " AND sid = {$storeid}"); + $otherorder = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . $condition . " AND sid = {$storeid} AND plugin != 'store' "); + $store['order'] = $rushorder + $otherorder; + $store['orderrate'] = sprintf("%.2f", $store['order'] / $data['allorder'] * 100); + $storelist[] = $store; + } + + if ($orderby == 'money') { + $storelist = Store::wl_sort($storelist, 'money', SORT_DESC, SORT_NUMERIC); + foreach ($storelist as $key => $st) { + $li = array('year' => $st['name'], '数据' => (float)$st['money']); + $list[] = $li; + } + + } else { + $storelist = Store::wl_sort($storelist, 'order', SORT_DESC, SORT_NUMERIC); + foreach ($storelist as $key => $st) { + $li = array('year' => $st['name'], '数据' => (float)$st['order']); + $list[] = $li; + } + } + $data['list'] = $list; + $data['storelist'] = $storelist; + } else { + $store = array(); + $store['name'] = pdo_getcolumn(PDO_NAME . 'merchantdata', array('id' => $sid), 'storename'); + //营业额 + $rushmoney = pdo_fetchcolumn('SELECT SUM(actualprice) FROM ' . tablename('wlmerchant_rush_order') . $condition . " AND sid = {$sid}"); + $othermoney = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . $condition . " AND sid = {$sid} AND plugin != 'store' "); + $store['money'] = sprintf("%.2f", $rushmoney + $othermoney); + $store['moneyrate'] = sprintf("%.2f", $store['money'] / $data['allmoney'] * 100); + //订单量 + $rushorder = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_rush_order') . $condition . " AND sid = {$sid}"); + $otherorder = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . $condition . " AND sid = {$sid} AND plugin != 'store' "); + $store['order'] = $rushorder + $otherorder; + $store['orderrate'] = sprintf("%.2f", $store['order'] / $data['allorder'] * 100); + $storelist[] = $store; + + if ($orderby == 'money') { + $li = array('year' => $store['name'], '数据' => (float)$store['money']); + $list[] = $li; + } else { + $li = array('year' => $store['name'], '数据' => (float)$store['order']); + $list[] = $li; + } + $data['list'] = $list; + $data['storelist'] = $storelist; + } + die(json_encode($data)); + } + + include wl_template('datacenter/stat_store'); + } + + //分销统计 + public function stat_distri() { + global $_W, $_GPC; + + //统计分销商总人数 + $distributornum = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_distributor') . " WHERE uniacid = {$_W['uniacid']} AND disflag IN (-1,1) "); + //分销商人数 + $distributor = pdo_fetchall("SELECT * FROM " . tablename('wlmerchant_distributor') . "WHERE uniacid = {$_W['uniacid']} AND disflag IN (1,-1) ORDER BY id DESC"); + + + $condition = " WHERE uniacid = {$_W['uniacid']}"; + + if ($_GPC['disid']) { + $disid = $_GPC['disid']; + $condition .= " AND ( oneleadid = {$disid} or twoleadid = {$disid})"; + } + + $orderby = $_GPC['orderby'] ? $_GPC['orderby'] : 'money'; + $daycon = $condition; + //时间 + $days = isset($_GPC['days']) ? intval($_GPC['days']) : 0; + if ($days == -1) { + $starttime = strtotime(trim($_GPC['stat_day']['start'])); + $endtime = strtotime(trim($_GPC['stat_day']['end'])); + $lenth = ceil((time() - $starttime) / 86400); + $i = ceil((time() - $endtime) / 86400); + $lenth = $lenth - $i + 1; + } else { + $todaytime = strtotime(date('Y-m-d')); + $starttime = strtotime("-{$days} days", $todaytime); + $endtime = $todaytime + 86399; + $lenth = $days + 1; + $i = 0; + } + + $selstarttime = date('Y-m-d', $starttime); + $selendtime = date('Y-m-d', $endtime); + + $condition .= " AND createtime > {$starttime} AND createtime < {$endtime}"; + + if ($_W['isajax']) { + $data = array( + 'disnum' => 0, 'allmoney' => 0, 'dismoney' => 0, 'rushmoney' => 0, 'rushnum' => 0, 'grouponmoney' => 0, 'grouponnum' => 0, + 'fightmoney' => 0, 'fightnum' => 0, 'couponmoney' => 0, 'couponnum' => 0, 'chargemoney' => 0, 'chargenum' => 0, 'halfmoney' => 0, 'halfnum' => 0, + 'distrimoney' => 0, 'distrinum' => 0, 'pocketmoney' => 0, 'pocketnum' => 0,'bargainnum' => 0,'citydeliverynum' => 0,'citycardnum' => 0,'citydeliverymoney'=>0, + 'citycardmoney' => 0,'bargainmoney' => 0 + ); + $disorders = pdo_fetchall('SELECT orderprice,leadmoney,plugin,oneleadid,twoleadid FROM ' . tablename('wlmerchant_disorder') . $condition); + $data['disnum'] = count($disorders); + $list = array(); + if ($disorders) { + foreach ($disorders as $key => $dis) { + $data['allmoney'] += $dis['orderprice']; + $disleadmoney = unserialize($dis['leadmoney']); + $leadmoney = $disleadmoney['one']; + if ($orderby == 'money') { + $list[$dis['oneleadid']] += $disleadmoney['one']; + } else { + $list[$dis['oneleadid']] += 1; + } + + if ($disleadmoney['two']) { + $leadmoney += $disleadmoney['two']; + if ($orderby == 'money') { + $list[$dis['twoleadid']] += $disleadmoney['two']; + } else if ($dis['twoleadid'] != $dis['oneleadid']) { + $list[$dis['twoleadid']] += 1; + } + } + $data['dismoney'] += $leadmoney; + if ($dis['plugin'] == 'rush') { + $data['rushmoney'] += $leadmoney; + $data['rushnum'] += 1; + } else if ($dis['plugin'] == 'groupon') { + $data['grouponmoney'] += $leadmoney; + $data['grouponnum'] += 1; + } else if ($dis['plugin'] == 'fightgroup') { + $data['fightmoney'] += $leadmoney; + $data['fightnum'] += 1; + } else if ($dis['plugin'] == 'coupon') { + $data['couponmoney'] += $leadmoney; + $data['couponnum'] += 1; + } else if ($dis['plugin'] == 'charge') { + $data['chargemoney'] += $leadmoney; + $data['chargenum'] += 1; + } else if ($dis['plugin'] == 'halfcard') { + $data['halfmoney'] += $leadmoney; + $data['halfnum'] += 1; + } else if ($dis['plugin'] == 'distribution') { + $data['distrimoney'] += $leadmoney; + $data['distrinum'] += 1; + } else if ($dis['plugin'] == 'pocket') { + $data['pocketmoney'] += $leadmoney; + $data['pocketnum'] += 1; + } else if ($dis['plugin'] == 'bargain') { + $data['bargainmoney'] += $leadmoney; + $data['bargainnum'] += 1; + } else if ($dis['plugin'] == 'citycard') { + $data['citycardmoney'] += $leadmoney; + $data['citycardnum'] += 1; + } else if ($dis['plugin'] == 'citydelivery') { + $data['citydeliverymoney'] += $leadmoney; + $data['citydeliverynum'] += 1; + } + } + + arsort($list); + $newlist = array(); + $ii = 1; + foreach ($list as $key => &$l) { + $nickname = pdo_getcolumn(PDO_NAME . 'distributor', array('id' => $key), 'nickname'); + if (empty($nickname) || !$nickname) { + $nickname = '未知' . $ii; + $ii++; + } + $li = array('year' => $nickname, '数据' => (float)$l); + $newlist[] = $li; + } + $newlist = array_slice($newlist, 0, 20); + } + + + $data['list'] = $newlist; + + die(json_encode($data)); + } + + //数据表 + $list = array(); + for ($i; $i < $lenth; $i++) { + $li = array( + 'ordernum' => 0, 'dismoney' => 0, 'rush' => 0, 'groupon' => 0, 'fight' => 0, + 'coupon' => 0, 'charge' => 0, 'half' => 0, 'distri' => 0, 'pocket' => 0, + 'bargain' => 0, 'citycard' => 0, 'citydelivery' => 0 + ); + $testday = date('d') - $i; + $teststa = mktime(0, 0, 0, date('m'), $testday, date('Y')); + $testend = mktime(23, 59, 59, date('m'), $testday, date('Y')); + + $disorders = pdo_fetchall('SELECT orderprice,leadmoney,plugin FROM ' . tablename('wlmerchant_disorder') . $daycon . " AND createtime > {$teststa} AND createtime < {$testend}"); + if ($disorders) { + $li['ordernum'] = count($disorders); + foreach ($disorders as $key => $dis) { + $disleadmoney = unserialize($dis['leadmoney']); + $leadmoney = $disleadmoney['one']; + if ($disleadmoney['two']) { + $leadmoney += $disleadmoney['two']; + } + $li['dismoney'] += $leadmoney; + if ($dis['plugin'] == 'rush') { + $li['rush'] += $leadmoney; + } else if ($dis['plugin'] == 'groupon') { + $li['groupon'] += $leadmoney; + } else if ($dis['plugin'] == 'fightgroup') { + $li['fight'] += $leadmoney; + } else if ($dis['plugin'] == 'coupon') { + $li['coupon'] += $leadmoney; + } else if ($dis['plugin'] == 'charge') { + $li['charge'] += $leadmoney; + } else if ($dis['plugin'] == 'halfcard') { + $li['half'] += $leadmoney; + } else if ($dis['plugin'] == 'distribution') { + $li['distri'] += $leadmoney; + } else if ($dis['plugin'] == 'pocket') { + $li['pocket'] += $leadmoney; + } else if ($dis['plugin'] == 'bargain') { + $li['bargain'] += $leadmoney; + } else if ($dis['plugin'] == 'citycard') { + $li['citycard'] += $leadmoney; + } else if ($dis['plugin'] == 'citydelivery') { + $li['citydelivery'] += $leadmoney; + } + } + } + $li['date'] = date('Y-m-d', $testend); + $list[] = $li; + } + + include wl_template('datacenter/stat_distri'); + } + + public function stat_store_card() { + global $_W, $_GPC; + $condition = is_agent() ? ['uniacid' => $_W['uniacid'], 'aid' => $_W['aid']] : ['uniacid' => $_W['uniacid']]; + //时间 + $days = isset($_GPC['days']) ? intval($_GPC['days']) : 6; + if ($days == -1) { + $starttime = strtotime(trim($_GPC['stat_day']['start'])); + $endtime = strtotime(trim($_GPC['stat_day']['end'])); + $lenth = ceil((time() - $starttime) / 86400); + $i = ceil((time() - $endtime) / 86400); + $lenth = $lenth - $i + 1; + } else { + $todaytime = strtotime(date('Y-m-d')); + $starttime = strtotime("-{$days} days", $todaytime); + $endtime = $todaytime + 86399; + $lenth = $days + 1; + $i = 0; + } + $daystext = ($days == 6) ? '近7天' : (($days == 29) ? '近30天' : date('Y-m-d', $starttime) . '-' . date('Y-m-d', $endtime)); + $where = ['createtime >' => $starttime, 'createtime <' => $endtime]; + + //代理列表增长数据 + if (!is_agent() && $_W['ispost']) { + $agents = pdo_getall('wlmerchant_agentusers', array('uniacid' => $_W['uniacid']), ['id', 'agentname']); + foreach ($agents as &$agent) { + $condition['aid'] = $agent['id']; + $adata = $this->stat_sc_get($condition, $where, 2); + $agent = array_merge($agent, $adata); + $agent['areaname'] = pdo_getcolumn('wlmerchant_area', ['id' => pdo_getcolumn('wlmerchant_oparea', ['uniacid' => $_W['uniacid'], 'aid' => $agent['id']], 'areaid')], 'name'); + unset($adata); + } + die(json_encode($agents)); + } + + $data = $this->stat_sc_get($condition, $where, 1); + + include wl_template('datacenter/stat_store_card'); + } + + private function stat_sc_get($condition, $where, $status = 1) { + $data = []; + $data['storenum'] = pdo_getcolumn('wlmerchant_merchantdata', array_merge($condition, ['enabled' => 1]), "count(id)"); + $data['cardnum'] = pdo_getcolumn('wlmerchant_halfcardmember', array_merge($condition), "count(id)"); + $data['storenew'] = pdo_getcolumn('wlmerchant_merchantdata', array_merge($condition, $where, ['enabled' => 1]), "count(id)"); + $data['cardnew'] = pdo_getcolumn('wlmerchant_halfcardmember', array_merge($condition, $where), "count(id)"); + if ($status == 1) { + $data['cardnew0'] = pdo_getcolumn('wlmerchant_halfcardmember', array_merge($condition, $where, ['from' => 0]), "count(id)"); + $data['cardnew1'] = pdo_getcolumn('wlmerchant_halfcardmember', array_merge($condition, $where, ['from' => 1]), "count(id)"); + $data['cardnew2'] = pdo_getcolumn('wlmerchant_halfcardmember', array_merge($condition, $where, ['from' => 2]), "count(id)"); + $data['cardnew3'] = pdo_getcolumn('wlmerchant_halfcardmember', array_merge($condition, $where, ['from' => 3]), "count(id)"); + } + return $data; + } +} diff --git a/addons/weliam_smartcity/sys/controller/finace/finaceBill.ctrl.php b/addons/weliam_smartcity/sys/controller/finace/finaceBill.ctrl.php new file mode 100644 index 0000000..68053e1 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/finace/finaceBill.ctrl.php @@ -0,0 +1,385 @@ + $_W['uniacid'], 'aid' => $_W['aid']) : array('uniacid' => $_W['uniacid']); + if(is_store()){ + $where['merchantid'] = $_W['storeid']; + } + if (!empty($_GPC['keyword'])) { + if (!empty($_GPC['keywordtype'])) { + switch($_GPC['keywordtype']) { + case 1 : + $where['@orderno@'] = $_GPC['keyword']; + break; + case 2 : + $where['orderprice>'] = $_GPC['keyword']; + break; + case 3 : + $where['orderprice<'] = $_GPC['keyword']; + break; + case 4 : + $where['agentmoney>'] = $_GPC['keyword']; + break; + case 5 : + $where['agentmoney<'] = $_GPC['keyword']; + break; + default : + break; + } + if ($_GPC['keywordtype'] == 6) { + $keyword = $_GPC['keyword']; + $params[':storename'] = "%{$keyword}%"; + $stores = pdo_fetchall("SELECT * FROM " . tablename('wlmerchant_merchantdata') . "WHERE uniacid = {$_W['uniacid']} AND storename LIKE :storename", $params); + if ($stores) { + $storesids = "("; + foreach ($stores as $key => $v) { + if ($key == 0) { + $storesids .= $v['id']; + } else { + $storesids .= "," . $v['id']; + } + } + $storesids .= ")"; + $where['merchantid#'] = $storesids; + } else { + $where['merchantid#'] = "(0)"; + } + } + if ($_GPC['keywordtype'] == 7) { + $keyword = $_GPC['keyword']; + if($keyword == '总后台'){ + $where['aid'] = 0; + }else{ + $params[':agentname'] = "%{$keyword}%"; + $agents = pdo_fetchall("SELECT * FROM " . tablename('wlmerchant_agentusers') . "WHERE uniacid = {$_W['uniacid']} AND agentname LIKE :agentname", $params); + if ($agents) { + $agentids = "("; + foreach ($agents as $key => $v) { + if ($key == 0) { + $agentids .= $v['id']; + } else { + $agentids .= "," . $v['id']; + } + } + $agentids .= ")"; + $where['aid#'] = $agentids; + } else { + $where['aid'] = "-1"; + } + } + } + } + } + $cashtype = trim($_GPC['cashtype']); + if (!empty($cashtype)) { + $where['type'] = $cashtype; + } + $where['type>'] = 1; + if ($_GPC['time_limit']) { + $time_limit = $_GPC['time_limit']; + $starttime = strtotime($_GPC['time_limit']['start']); + $endtime = strtotime($_GPC['time_limit']['end']); + $where['createtime>'] = $starttime; + $where['createtime<'] = $endtime; + } + + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time()+86400; + } + + if ($_GPC['export'] != '') { + $this -> export($where); + } + $records = Util::getNumData('*', 'wlmerchant_autosettlement_record', $where, 'ID DESC', $pindex, $psize, 1); + $pager = $records[1]; + $records = $records[0]; + foreach ($records as $key => &$va) { + $va['storename'] = pdo_getcolumn(PDO_NAME . 'merchantdata', array('id' => $va['merchantid']), 'storename'); + if($va['aid'] > 0){ + $va['agentuser'] = pdo_getcolumn(PDO_NAME . 'agentusers', array('id' => $va['aid']), 'agentname'); + }else{ + $va['agentuser'] = '总后台'; + } + if (empty($va['orderno'])) { + $va['orderno'] = $va['orderid']; + } + if ($va['type'] == 1) { + $va['typename'] = '抢购'; + $va['title'] = pdo_getcolumn(PDO_NAME . 'rush_activity', array('id' => $va['goodsid']), 'name'); + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 1, 'orderid' => $va['orderid'])); + }else if($va['type'] == 10) { + $va['typename'] = '团购'; + $va['title'] = pdo_getcolumn(PDO_NAME . 'groupon_activity', array('id' => $va['goodsid']), 'name'); + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 10, 'orderid' => $va['orderid'])); + } else if ($va['type'] == 2) { + $va['typename'] = '拼团'; + $va['title'] = pdo_getcolumn(PDO_NAME . 'fightgroup_goods', array('id' => $va['goodsid']), 'name'); + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 2, 'orderid' => $va['orderid'])); + } else if ($va['type'] == 3) { + $va['typename'] = '卡券'; + $va['title'] = pdo_getcolumn(PDO_NAME . 'couponlist', array('id' => $va['goodsid']), 'title'); + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 3, 'orderid' => $va['orderid'])); + } else if ($va['type'] == 4) { + $va['typename'] = '一卡通'; + $va['title'] = pdo_getcolumn(PDO_NAME . 'halfcard_type', array('id' => $va['goodsid']), 'name'); + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 4, 'orderid' => $va['orderid'])); + } else if ($va['type'] == 5) { + $va['typename'] = '掌上信息'; + $va['title'] = '付费发帖'; + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 5, 'orderid' => $va['orderid'])); + } else if ($va['type'] == 6) { + $va['typename'] = '付费入驻'; + $va['title'] = pdo_getcolumn(PDO_NAME . 'chargelist', array('id' => $va['goodsid']), 'name'); + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 6, 'orderid' => $va['orderid'])); + } else if ($va['type'] == 7) { + if($va['merchantid']){ + if ($va['merchantmoney'] < 0) { + $va['typename'] = '提现申请'; + $va['title'] = '商户申请提现'; + } else { + $va['typename'] = '提现申请驳回'; + $va['title'] = '商户申请被驳回'; + } + }else{ + if ($va['agentmoney'] < 0) { + $va['typename'] = '提现申请'; + $va['title'] = '代理申请提现'; + } else { + $va['typename'] = '提现申请驳回'; + $va['title'] = '代理申请被驳回'; + } + } + if(is_agent()){ + $va['orderurl'] = web_url('finace/finaceWithdrawal/cashApplyAgentRecord',array('orderid' => $va['orderid'])); + }else{ + $va['orderurl'] = web_url('finace/finaceWithdrawalApply/cashApply',array('orderid' => $va['orderid'])); + } + }else if ($va['type'] == 8) { + if(Customized::init('distributionText') > 0){ + $va['typename'] = '共享股东'; + $va['title'] = '付费成为共享股东'; + }else{ + $va['typename'] = '分销合伙人'; + $va['title'] = '付费成为分销商'; + } + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 8, 'orderid' => $va['orderid'])); + }else if ($va['type'] == 9) { + $va['typename'] = '商户活动'; + $va['title'] = pdo_getcolumn(PDO_NAME.'activitylist',array('id' => $va['goodsid']),'title'); + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 9, 'orderid' => $va['orderid'])); + }else if ($va['type'] == 11) { + $va['typename'] = '在线买单'; + $va['title'] = pdo_getcolumn(PDO_NAME.'halfcardlist',array('id' => $va['goodsid']),'title'); + $va['title'] = $va['title']?$va['title']:'买家在线买单'; + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 11, 'orderid' => $va['orderid'])); + }else if ($va['type'] == 12) { + $va['typename'] = '砍价商品'; + $va['title'] = pdo_getcolumn(PDO_NAME.'bargain_activity',array('id' => $va['goodsid']),'name'); + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 12, 'orderid' => $va['orderid'])); + }else if ($va['type'] == 13) { + $va['typename'] = '同城名片'; + $fightstatus = pdo_getcolumn(PDO_NAME.'order',array('id' => $va['orderid']),'fightstatus'); + if($fightstatus == 1){ + $va['title'] = pdo_getcolumn(PDO_NAME.'citycard_meals',array('id' => $va['goodsid']),'name'); + }else{ + $va['title'] = pdo_getcolumn(PDO_NAME.'citycard_tops',array('id' => $va['goodsid']),'name'); + } + $va['orderurl'] = web_url('citycard/citycard/order_lists', array('keywordtype' => 3, 'keyword' => $va['orderno'])); + }else if ($va['type'] == 14) { + $va['typename'] = '同城配送'; + $smallorder = pdo_getall('wlmerchant_delivery_order',array('tid'=>$va['orderno']),array('gid','num','specid')); + $va['title'] = ''; + foreach ($smallorder as $ke => &$orr){ + $goods = pdo_get('wlmerchant_delivery_activity',array('id' => $orr['gid']),array('name')); + if($orr['specid']>0){ + $specname = pdo_getcolumn(PDO_NAME.'delivery_spec',array('id'=>$orr['specid']),'name'); + $goods['name'] .= '/'.$specname; + } + $va['title'] .= '['.$goods['name'].'X'.$orr['num'].']'; + } + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 14, 'orderid' => $va['orderid'])); + }else if($va['type'] == 15){ + $va['typename'] = '黄页114'; + $order = pdo_get('wlmerchant_order',array('id' => $va['orderid']),array('fightstatus')); + $yellow = pdo_get('wlmerchant_yellowpage_lists' , ['id' => $va['goodsid']],['name']); + switch ($order['fightstatus']) { + case '1': + $va['title'] = '页面['.$yellow['name'].']认领'; + break; + case '2': + $va['title'] = '页面['.$yellow['name'].']查阅'; + break; + case '3': + $va['title'] = '页面['.$yellow['name'].']入驻'; + break; + case '4': + $va['title'] = '页面['.$yellow['name'].']续费'; + break; + } + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 15, 'orderid' => $va['orderid'])); + }else if($va['type'] == 16){ + $va['typename'] = '求职招聘'; + $order = pdo_get('wlmerchant_order',array('id' => $va['orderid']),array('fightstatus')); + switch ($order['fightstatus']) { + case '1': + $va['title'] = '招聘信息发布'; + break; + case '2': + $va['title'] = '招聘信息置顶'; + break; + } + $va['orderurl'] = web_url('order/wlOrder/orderdetail', array('type' => 16, 'orderid' => $va['orderid'])); + } + + } + include wl_template('finace/cashrecord'); + } + //导出账单明细 + public function export($where) { + + if (empty($where)){ + return FALSE; + } + set_time_limit(0); + $records = Util::getNumData('*', 'wlmerchant_autosettlement_record', $where, 'ID DESC', 0, 0, 1); + $records = $records[0]; + foreach ($records as $key => &$rec) { + $rec['storename'] = pdo_getcolumn(PDO_NAME . 'merchantdata', array('id' => $rec['merchantid']), 'storename'); + if($rec['aid'] > 0){ + $rec['agentname'] = pdo_getcolumn(PDO_NAME . 'agentusers', array('id' => $rec['aid']), 'agentname'); + }else{ + $rec['agentname'] = '总后台'; + } + if (empty($rec['orderno'])) { + $rec['orderno'] = $rec['orderid']; + } + if ($rec['type'] == 1) { + $rec['typename'] = '抢购'; + $rec['title'] = pdo_getcolumn(PDO_NAME . 'rush_activity', array('id' => $rec['goodsid']), 'name'); + } else if ($rec['type'] == 2) { + $rec['typename'] = '拼团'; + $rec['title'] = pdo_getcolumn(PDO_NAME . 'fightgroup_goods', array('id' => $rec['goodsid']), 'name'); + } else if ($rec['type'] == 3) { + $rec['typename'] = '卡券'; + $rec['title'] = pdo_getcolumn(PDO_NAME . 'couponlist', array('id' => $rec['goodsid']), 'title'); + } else if ($rec['type'] == 4) { + $rec['typename'] = '一卡通'; + $rec['title'] = pdo_getcolumn(PDO_NAME . 'halfcard_type', array('id' => $rec['goodsid']), 'name'); + } else if ($rec['type'] == 5) { + $rec['typename'] = '掌上信息'; + $rec['title'] = '付费发帖'; + } else if ($rec['type'] == 6) { + $rec['typename'] = '付费入驻'; + $rec['title'] = pdo_getcolumn(PDO_NAME . 'chargelist', array('id' => $rec['goodsid']), 'name'); + } else if ($rec['type'] == 7) { + if ($rec['agentmoney'] < 0) { + $rec['typename'] = '提现申请'; + $rec['title'] = '代理申请提现'; + } else { + $rec['typename'] = '提现申请驳回'; + $rec['title'] = '代理申请被驳回'; + } + }else if ($rec['type'] == 8) { + if(Customized::init('distributionText') > 0){ + $rec['typename'] = '共享股东'; + $rec['title'] = '付费成为共享股东'; + }else{ + $rec['typename'] = '分销合伙人'; + $rec['title'] = '付费成为分销商'; + } + }else if ($rec['type'] == 9) { + $rec['typename'] = '商户活动'; + $rec['title'] = pdo_getcolumn(PDO_NAME.'activitylist',array('id' => $rec['goodsid']),'title'); + }else if($rec['type'] == 10) { + $rec['typename'] = '团购'; + $rec['title'] = pdo_getcolumn(PDO_NAME . 'groupon_activity', array('id' => $rec['goodsid']), 'name'); + } else if ($rec['type'] == 11) { + $rec['typename'] = '在线买单'; + $rec['title'] = pdo_getcolumn(PDO_NAME.'halfcardlist',array('id' => $rec['goodsid']),'title'); + $rec['title'] = $rec['title']?$rec['title']:'买家在线买单'; + }else if ($rec['type'] == 12) { + $rec['typename'] = '砍价商品'; + $rec['title'] = pdo_getcolumn(PDO_NAME.'bargain_activity',array('id' => $rec['goodsid']),'name'); + }else if ($rec['type'] == 13) { + $rec['typename'] = '同城名片'; + $fightstatus = pdo_getcolumn(PDO_NAME.'order',array('id' => $rec['orderid']),'fightstatus'); + if($fightstatus == 1){ + $rec['title'] = pdo_getcolumn(PDO_NAME.'citycard_meals',array('id' => $rec['goodsid']),'name'); + }else{ + $rec['title'] = pdo_getcolumn(PDO_NAME.'citycard_tops',array('id' => $rec['goodsid']),'name'); + } + }else if ($rec['type'] == 14) { + $rec['typename'] = '同城配送'; + $smallorder = pdo_getall('wlmerchant_delivery_order',array('tid'=>$rec['orderno']),array('gid','specid','num')); + $rec['title'] = ''; + foreach ($smallorder as $ke => &$orr){ + $goods = pdo_get('wlmerchant_delivery_activity',array('id' => $orr['gid']),array('name')); + if($orr['specid']>0){ + $specname = pdo_getcolumn(PDO_NAME.'delivery_spec',array('id'=>$orr['specid']),'name'); + $goods['name'] .= '/'.$specname; + } + $rec['title'] .= '['.$goods['name'].'X'.$orr['num'].']'; + } + } + $rec['createtime'] = date('Y-m-d H:i:s', $rec['createtime']); + $rec['title'] = str_replace(",",",",$rec['title']); + } + + /* 输入到CSV文件 */ + $html = "\xEF\xBB\xBF"; + /* 输出表头 */ + $filter['orderno'] = '订单号'; + $filter['title'] = '商品名称'; + $filter['agentname'] = '代理名称'; + $filter['storename'] = '所属商家'; + $filter['typename'] = '结算类型'; + $filter['orderprice'] = '订单金额'; + $filter['merchantmoney'] = '商户收入'; + if(Customized::init('distributionText') > 0){ + $filter['distrimoney'] = '共享股东佣金'; + }else{ + $filter['distrimoney'] = '分销佣金'; + } + if(p('salesman')) $filter['salesmoney'] = '业务员佣金'; + $filter['agentmoney'] = '代理收入'; + $filter['agentnowmoney'] = '结算后代理余额'; + $filter['createtime'] = '结算时间'; + + foreach ($filter as $key => $title) { + $html .= $title . "\t,"; + } + $html .= "\n"; + + foreach ($records as $k => $v) { + foreach ($filter as $key => $title) { + if ($key == 'orderprice' || $key == 'merchantmoney' || $key == 'agentmoney' || $key == 'agentnowmoney') { + $html .= trim($v[$key]) . trim("\t") . ","; + } else { + $html .= $v[$key] . "\t, "; + } + } + $html .= "\n"; + } + /* 输出CSV文件 */ + header("Content-type:text/csv"); + header("Content-Disposition:attachment; filename=结算记录.csv"); + echo $html; + exit(); + } + + +} diff --git a/addons/weliam_smartcity/sys/controller/finace/finaceRefundRecord.ctrl.php b/addons/weliam_smartcity/sys/controller/finace/finaceRefundRecord.ctrl.php new file mode 100644 index 0000000..15c59e9 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/finace/finaceRefundRecord.ctrl.php @@ -0,0 +1,282 @@ + $v) { + if ($key == 0) { + $storesids .= $v['id']; + } else { + $storesids .= "," . $v['id']; + } + } + $storesids .= ")"; + $where['mid#'] = $storesids; + } else { + $where['mid#'] = "(0)"; + } + } + if ($_GPC['keywordtype'] == 4) { + $keyword = $_GPC['keyword']; + $params[':mobile'] = "%{$keyword}%"; + $stores = pdo_fetchall("SELECT * FROM " . tablename('wlmerchant_member') . "WHERE uniacid = {$_W['uniacid']} AND mobile LIKE :mobile", $params); + if ($stores) { + $storesids = "("; + foreach ($stores as $key => $v) { + if ($key == 0) { + $storesids .= $v['id']; + } else { + $storesids .= "," . $v['id']; + } + } + $storesids .= ")"; + $where['mid#'] = $storesids; + } else { + $where['mid#'] = "(0)"; + } + } + if ($_GPC['keywordtype'] == 5) { + $keyword = $_GPC['keyword']; + $params[':storename'] = "%{$keyword}%"; + $stores = pdo_fetchall("SELECT * FROM " . tablename('wlmerchant_merchantdata') . "WHERE uniacid = {$_W['uniacid']} AND storename LIKE :storename", $params); + if ($stores) { + $storesids = "("; + foreach ($stores as $key => $v) { + if ($key == 0) { + $storesids .= $v['id']; + } else { + $storesids .= "," . $v['id']; + } + } + $storesids .= ")"; + $where['sid#'] = $storesids; + } else { + $where['sid#'] = "(0)"; + } + } + } + } + + + //时间 + if ($_GPC['time_limit']) { + $time_limit = $_GPC['time_limit']; + $starttime = strtotime($_GPC['time_limit']['start']); + $endtime = strtotime($_GPC['time_limit']['end']); + $where['createtime>'] = $starttime; + $where['createtime<'] = $endtime; + } + + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time()+86400; + } + if ($_GPC['export'] != '') { + $this -> exportrefund($where); + } + + $records = Util::getNumData('*','wlmerchant_refund_record',$where,'createtime DESC',$pindex,$psize,1); + $pager = $records[1]; + $records = $records[0]; + foreach ($records as $key => &$re) { + $re['createtime'] = date('Y-m-d H:i:s',$re['createtime']); + $re['storename'] = pdo_getcolumn(PDO_NAME.'merchantdata',array('id'=>$re['sid']),'storename'); + $member = pdo_get('wlmerchant_member',array('id' => $re['mid']),array('avatar','nickname')); + $re['avatar'] = $member['avatar']; + $re['nickname'] = $member['nickname']; + if($re['plugin'] == 'rush'){ + $goodsid = pdo_getcolumn(PDO_NAME.'rush_order',array('id'=>$re['orderid']),'activityid'); + $re['goodsname'] = pdo_getcolumn(PDO_NAME.'rush_activity',array('id'=>$goodsid),'name'); + $re['pluginname'] = '抢购'; + }else if($re['plugin'] == 'wlfightgroup'){ + $goodsid = pdo_getcolumn(PDO_NAME.'order',array('id'=>$re['orderid']),'fkid'); + $re['goodsname'] = pdo_getcolumn(PDO_NAME.'fightgroup_goods',array('id'=>$goodsid),'name'); + $re['pluginname'] = '拼团'; + }else if($re['plugin'] == 'groupon'){ + $goodsid = pdo_getcolumn(PDO_NAME.'order',array('id'=>$re['orderid']),'fkid'); + $re['goodsname'] = pdo_getcolumn(PDO_NAME.'groupon_activity',array('id'=>$goodsid),'name'); + $re['pluginname'] = '团购'; + }else if($re['plugin'] == 'bargain'){ + $goodsid = pdo_getcolumn(PDO_NAME.'order',array('id'=>$re['orderid']),'fkid'); + $re['goodsname'] = pdo_getcolumn(PDO_NAME.'bargain_activity',array('id'=>$goodsid),'name'); + $re['pluginname'] = '砍价'; + } + switch ($re['paytype']){ + case '2': + $re['paytype'] = '微信支付'; + break; + case '1': + $re['paytype'] = '余额支付'; + break; + case '3': + $re['paytype'] = '支付宝'; + break; + case '4': + $re['paytype'] = '货到付款'; + break; + case '5': + $re['paytype'] = '小程序'; + break; + default: + $re['paytype'] = '未知方式'; + break; + } + switch ($re['type']) { + case '1': + $re['type'] = '手机端退款'; + break; + case '2': + $re['type'] = '后台退款'; + break; + case '3': + $re['type'] = '自动退款'; + break; + default: + $re['type'] = '其他'; + break; + } + } + include wl_template('finace/refundrecord'); + } + //导出退款记录 + public function exportrefund($where){ + if (empty($where)){ + return FALSE; + } + set_time_limit(0); + $records = Util::getNumData('*','wlmerchant_refund_record',$where,'createtime DESC',0,0,1); + $records = $records[0]; + foreach ($records as $key => &$re) { + $re['createtime'] = date('Y-m-d H:i:s',$re['createtime']); + $re['storename'] = pdo_getcolumn(PDO_NAME.'merchantdata',array('id'=>$re['sid']),'storename'); + $member = pdo_get('wlmerchant_member',array('id' => $re['mid']),array('nickname')); + $re['nickname'] = $member['nickname']; + $re['status'] = $re['status'] > 0 ? '成功':'失败'; + $re['orderno'] = "\t".$re['orderno']."\t"; + if($re['plugin'] == 'rush'){ + $goodsid = pdo_getcolumn(PDO_NAME.'rush_order',array('id'=>$re['orderid']),'activityid'); + $re['goodsname'] = pdo_getcolumn(PDO_NAME.'rush_activity',array('id'=>$goodsid),'name'); + $re['pluginname'] = '抢购'; + }else if($re['plugin'] == 'wlfightgroup'){ + $goodsid = pdo_getcolumn(PDO_NAME.'order',array('id'=>$re['orderid']),'fkid'); + $re['goodsname'] = pdo_getcolumn(PDO_NAME.'fightgroup_goods',array('id'=>$goodsid),'name'); + $re['pluginname'] = '拼团'; + }else if($re['plugin'] == 'groupon'){ + $goodsid = pdo_getcolumn(PDO_NAME.'order',array('id'=>$re['orderid']),'fkid'); + $re['goodsname'] = pdo_getcolumn(PDO_NAME.'groupon_activity',array('id'=>$goodsid),'name'); + $re['pluginname'] = '团购'; + }else if($re['plugin'] == 'bargain'){ + $goodsid = pdo_getcolumn(PDO_NAME.'order',array('id'=>$re['orderid']),'fkid'); + $re['goodsname'] = pdo_getcolumn(PDO_NAME.'bargain_activity',array('id'=>$goodsid),'name'); + $re['pluginname'] = '砍价'; + } + switch ($re['paytype']){ + case '2': + $re['paytype'] = '微信支付'; + break; + case '1': + $re['paytype'] = '余额支付'; + break; + case '3': + $re['paytype'] = '支付宝'; + break; + case '4': + $re['paytype'] = '货到付款'; + break; + case '5': + $re['paytype'] = '小程序'; + break; + default: + $re['paytype'] = '未知方式'; + break; + } + switch ($re['type']) { + case '1': + $re['type'] = '手机端退款'; + break; + case '2': + $re['type'] = '后台退款'; + break; + case '3': + $re['type'] = '自动退款'; + break; + default: + $re['type'] = '其他'; + break; + } + } + + /* 输出表头 */ + $filter = array( + 'id' => '记录id',//U + 'orderno' => '订单号',//A + 'pluginname' => '所属应用',//B + 'goodsname' => '商品名称',//C + 'storename' => '所属商家',//F + 'nickname' => '买家昵称',//G + 'status' => '退款状态',//I + 'paytype' => '支付方式',//J + 'createtime' => '退款时间',//K + 'refundfee' => '退款金额',//M + 'remark' => '退款备注',//N + 'type' => '退款方式',//O + 'errmsg' => '退款描述'//P + ); + $data = array(); + for ($i=0; $i < count($records) ; $i++) { + foreach ($filter as $key => $title) { + $data[$i][$key] = $records[$i][$key]; + } + } + util_csv::export_csv_2($data, $filter, '退款记录表.csv'); + exit(); + } + +} diff --git a/addons/weliam_smartcity/sys/controller/finace/finaceWithdrawalApply.ctrl.php b/addons/weliam_smartcity/sys/controller/finace/finaceWithdrawalApply.ctrl.php new file mode 100644 index 0000000..ae2e5be --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/finace/finaceWithdrawalApply.ctrl.php @@ -0,0 +1,574 @@ + 3, 'updatetime' => TIMESTAMP, 'trade_no' => $trade_no), array('id' => $_GPC['id'])); + //模板消息 + $record = pdo_get(PDO_NAME.'settlement_record',array('id'=> $_GPC['id']),array('id','type','payment_type','uniacid','sapplymoney','sopenid','sid','mid')); + if($record['type'] == 3){ + $url = h5_url('pages/subPages/dealer/withdraw/withdrawrecord',['draw_id'=>$_GPC['id']]); + Distribution::distriNotice($record['mid'],$url,4,0,$record['sapplymoney']); + }else{ + if($record['type'] == 1){ + $merchant = pdo_get('wlmerchant_merchantdata' , ['id' => $record['sid']] , ['autocash']); + if ($cashsets['autocash'] && $record['payment_type'] != 3 && $merchant['autocash']) { + Queue::addTask(4 , $record['id'] , time() , $record['id']); + } + $record['mid'] = pdo_getcolumn(PDO_NAME . 'merchantuser', array('storeid' => $record['sid'],'ismain' => 1), 'mid'); + }else if($record['type'] == 2){ + if ($cashsets['agentautocash'] && $record['payment_type'] != 3) { + Queue::addTask(4 , $record['id'] , time() , $record['id']); + } + $record['mid'] = pdo_getcolumn(PDO_NAME . 'member', array('openid' => $record['sopenid']), 'id'); + }else if($record['type'] == 5){ + $set = Setting::wlsetting_read('dating_set'); + if($set['automatic_payment'] == 1){ + //开启自动打款 调用计划任务进行自动打款 + Queue::addTask(4, $record['id'] , time(), $record['id']); + } + } + $first = '您的提现申请已通过审核'; + $type = '提现申请'; + $status = '已通过审核'; + $content = '申请金额:¥'.$record['sapplymoney']; + if($record['sid']){ + $remark = '系统管理员会尽快打款,点击查看申请记录'; + $url = ''; + }else{ + $remark = '系统管理员会尽快打款'; + $url = ''; + } + News::jobNotice($record['mid'],$first,$type,$content,$status,$remark,time(),$url); + if($record['type'] == 1){ + News::addSysNotice($record['uniacid'],3,$record['sid'],0,$_GPC['id'],1); + } + } + show_json(1,'提交成功'); + } else if ($_GPC['type'] == 'reject' && !empty($_GPC['id'])) { + //返回提现金额给提现申请人 + $record = pdo_get(PDO_NAME . 'settlement_record', array('id' => $_GPC['id']), array('uniacid','sopenid','type', 'sid', 'aid', 'sapplymoney', 'id','mid')); + if ($record['type'] == 1) { + $res = Store::settlement($record['id'], 0, $record['sid'], $record['sapplymoney'], 0, $record['sapplymoney'],7,0,0,$record['aid']); + $status = -1; + } else if ($record['type'] == 2) { + $res = Store::settlement($record['id'], 0, 0, $record['sapplymoney'], 0, 0,7,0,0,$record['aid']); + $status = -1; + }else if($record['type'] == 3){ + $nowmoney = pdo_getcolumn(PDO_NAME."distributor",array('mid'=>$record['mid']),'nowmoney'); + $totalNowMonet = $nowmoney+$record['sapplymoney']; + $res = pdo_update(PDO_NAME."distributor",array('nowmoney'=>$totalNowMonet),array('mid'=>$record['mid'])); + if(Customized::init('distributionText') > 0){ + $Cremark = '共享股东佣金提现申请驳回'; + }else{ + $Cremark = '分销佣金提现申请驳回'; + } + Distribution::adddisdetail($record['id'],$record['mid'],$record['mid'], 1, $record['sapplymoney'], 'cash', 1, $Cremark, $totalNowMonet); + $status = 11; + } else if ($record['type'] == 4) { + $res = Member::credit_update_credit2($record['mid'],$record['sapplymoney'],'用户提现被驳回',$record['id']); + $status = -1; + }else if($record['type'] == 5){ + $commission = pdo_getcolumn(PDO_NAME."dating_matchmaker",['mid' => $record['mid'],'uniacid' => $_W['uniacid']],'commission'); + $totalCommission = sprintf("%.2f",$commission + $record['sapplymoney']); + pdo_update(PDO_NAME."dating_matchmaker",['commission' => $totalCommission],['mid' => $record['mid']]); + Dating::commissionChangeRecord($record['mid'],$record['sapplymoney'],'提现申请被驳回',1); + $status = 17; + } + pdo_update(PDO_NAME . 'settlement_record', array('status' => $status, 'updatetime' => TIMESTAMP), array('id' => $_GPC['id'])); + //模板消息 + if($record['type'] == 3){ + $url = h5_url('pages/subPages/dealer/withdraw/withdrawrecord',['draw_id'=>$_GPC['id']]); + Distribution::distriNotice($record['mid'],$url,5,0,$record['sapplymoney']); + }else { + $first = '您的提现申请已被驳回'; + $type = '提现申请'; + $status = '申请被驳回'; + $content = '申请金额:¥' . $record['sapplymoney']; + if ($record['sid']) { + $remark = '您可以重新提交申请,点击查看申请记录'; + } else { + $remark = '您可以在后台重新提交申请'; + } + News::jobNotice($record['mid'], $first, $type, $content, $status, $remark, time()); + if ($record['type'] == 1) { + News::addSysNotice($record['uniacid'], 3, $record['sid'], 0, $_GPC['id'], 2); + } + } + show_json(1,'驳回成功'); + } else { + $pindex = max(1, intval($_GPC['page'])); + $psize = 10; + $where = array('uniacid' => $_W['uniacid']); + if (!empty($_GPC['status'])) { + switch ($_GPC['status']){ + case 1:break;//不限 + case 2:$where['status'] = array(2,6,7,15);break;//待审核 + case 3:$where['status'] = array(3,8,16);break;//待打款 + case 4:$where['status'] = array(4,5,9,18);break;//已完成 + case 5:$where['status'] = array(-1,10,11,17);break;//未通过 + } + } + if (!empty($_GPC['type'])) { + $where['type'] = intval($_GPC['type']); + } + if(!empty($_GPC['orderid'])){ + $where['id'] = intval($_GPC['orderid']); + } + if($_GPC['type'] == 3 && !empty($_GPC['disid'])){ + $where['disid'] = intval($_GPC['disid']); + } + + //时间 + if (!empty($_GPC['time'])){ + $starttime = strtotime($_GPC['time']['start']); + $endtime = strtotime($_GPC['time']['end']); + $where['applytime >'] = $starttime; + $where['applytime <'] = $endtime+86400; + } + + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + + //如果是导出记录则查询所有信息 + if($_GPC['export']){ + $list = pdo_getslice(PDO_NAME . 'settlement_record', $where, '', $total, array(), '', 'id DESC'); + }else{ + $list = pdo_getslice(PDO_NAME . 'settlement_record', $where, array($pindex, $psize), $total, array(), '', 'id DESC'); + } + foreach ($list as $key => &$relue) { + $relue['spercent'] = sprintf("%.2f", $relue['spercent']); + //获取提现人基本信息 + if ($relue['type'] == 1) { + //获取商户收款账号信息 + $accountInfo = Store::getShopOwnerInfo($relue['sid'],$relue['aid']); + $relue['name'] = Util::idSwitch('sid', 'sName', $relue['sid']); + $relue['currurl'] = web_url('finace/newCash/currentlist',array('type'=>'store','objid'=>$relue['sid'])); + } else if ($relue['type'] == 2) { + //获取代理商收款账号信息 + $accountInfo = pdo_get(PDO_NAME."agentusers",array('id'=>$relue['aid'],'uniacid'=>$_W['uniacid']),array('alipay','bank_name','card_number','bank_username')); + $relue['name'] = Util::idSwitch('aid', 'aName', $relue['aid']); + $relue['currurl'] = web_url('finace/newCash/currentlist',array('type'=>'agent','objid'=>$relue['aid'])); + }else if($relue['type'] == 3){ + //获取分销商收款账号信息 + $accountInfo = pdo_get(PDO_NAME."member",array('id'=>$relue['mid'],'uniacid'=>$_W['uniacid']),array('alipay','bank_name','card_number','nickname','bank_username')); + $relue['name'] = $accountInfo['nickname']; + $relue['currurl'] = web_url('distribution/dissysbase/disdetail',array('keywordtype'=>'1','keyword'=>$relue['mid'])); + }else if($relue['type'] == 4){ + //获取用户提现收款账号信息 + $accountInfo = pdo_get(PDO_NAME."member",array('id'=>$relue['mid'],'uniacid'=>$_W['uniacid']),array('alipay','bank_name','card_number','nickname','bank_username')); + $relue['name'] = $accountInfo['nickname']; + $relue['currurl'] = web_url('member/memberFinancialDetails/balance',array('keywordtype'=>'1','keyword'=>$relue['mid'])); + }else if($relue['type'] == 5){ + //获取用户提现收款账号信息 + $accountInfo = pdo_get(PDO_NAME."member",['id'=> $relue['mid'],'uniacid' => $_W['uniacid']],['alipay','bank_name','card_number','nickname','bank_username']); + $relue['name'] = $accountInfo['nickname']; + $relue['currurl'] = 'javascript:;'; + } + //获取商家的支付宝 银行卡信息 + if($relue['payment_type'] == 1 || $relue['payment_type'] == 3 || $relue['payment_type'] == 5) { + if($accountInfo){ + $relue['alipay'] = $accountInfo['alipay']; + $relue['bank_name'] = $accountInfo['bank_name']; + $relue['card_number'] = $accountInfo['card_number']; + $relue['bank_username'] = $accountInfo['bank_username']; + } + } + //如果是导出操作 需要进行数据的重新组装 + if($_GPC['export']){ + $data[$key]['name'] = $relue['name'];//提现人信息 + $data[$key]['sapplymoney'] = $relue['sapplymoney'];//申请提现金额 + $data[$key]['spercentmoney'] = $relue['spercentmoney'];//手续费 + $data[$key]['sgetmoney'] = $relue['sgetmoney'];//实际到账金额 + $data[$key]['applytime'] = date("Y-m-d H:i:s",$relue['applytime']);//申请时间 + $data[$key]['updatetime'] = $relue['updatetime']?date("Y-m-d H:i:s",$relue['updatetime']):'';//操作时间 + + //获取打款状态 + switch ($relue['status']){ + case 1:$statueRes = '审核中';break; + case 2:case 6:case 7:$statueRes = '待审核';break; + case 3:case 8:$statueRes = '待打款';break; + case 4:case 5:case 9:$statueRes = '提现成功';break; + case -1:case 10:case 11:$statueRes = '驳回申请';break; + } + $data[$key]['status'] = $statueRes; + //获取提现类型 + switch ($relue['type']){ + case 1:$typeRes = '商家提现';break; + case 2:$typeRes = '代理提现';break; + case 3: + if(Customized::init('distributionText') > 0){ + $typeRes = '共享股东提现'; + }else{ + $typeRes = '分销提现'; + } + break; + } + $data[$key]['type'] = $typeRes;//提现类型 + //获取提现方式 + switch ($relue['payment_type']){ + case 1:$paymentTypeRes = '支付宝';break; + case 2:$paymentTypeRes = '微信';break; + case 3:$paymentTypeRes = '银行卡';break; + case 4:$paymentTypeRes = '余额';break; + case 5:$paymentTypeRes = '任意';break; + default:$paymentTypeRes = '微信';break; + } + $data[$key]['payment_type'] = $paymentTypeRes;//提现类型 + //获取到账类型 + switch ($relue['settletype']){ + case 1:case 3:$settleTypeRes = '手动处理';break; + case 2:$settleTypeRes = '微信零钱';break; + case 4:$settleTypeRes = '余额到账';break; + case 5:$settleTypeRes = '微信红包';break; + case 6:$settleTypeRes = '支付宝打款';break; + default:$settleTypeRes = '未打款';break; + } + $data[$key]['settletype'] = $settleTypeRes;//到账类型 + $data[$key]['alipay'] = $relue['alipay']; + $data[$key]['bank_name'] = $relue['bank_name']; + $data[$key]['card_number'] = "\t".$relue['card_number']."\t"; + $data[$key]['bank_username'] = $relue['bank_username']; + } + } + //进行导出操作 + if($_GPC['export']){ + //设置表格的标题信息 + $titleInfo = array( + 'name' => '提现人信息', + 'sapplymoney' => '申请提现金额', + 'spercentmoney' => '手续费', + 'sgetmoney' => '实际到账金额', + 'applytime' => '申请时间', + 'updatetime' => '操作时间', + 'status' => '打款状态', + 'type' => '提现类型', + 'payment_type' => '提现方式', + 'settletype' => '到账类型', + 'alipay' => '支付宝账号', + 'bank_name' => '开户行名字', + 'card_number' => '银行卡号', + 'bank_username' => '开户人姓名' + ); + //开始导出.cvs文件 + util_csv::export_csv_2($data, $titleInfo, '提现申请信息.csv'); + exit(); + } + $pager = wl_pagination($total, $pindex, $psize); + } + + include wl_template('finace/cashConfirm'); + } + //导出记录 + public function output() { + global $_W, $_GPC; + + $where['id'] = $_GPC['id']; + $settlementRecord = Util::getSingelData('*', PDO_NAME . 'settlement_record', $where); + $orders = unserialize($settlementRecord['ids']); + $list = array(); + if ($settlementRecord['type'] == 1) { + foreach ($orders as $id) { + if ($settlementRecord['type2'] == 1) { + $v = Util::getSingelData('*', PDO_NAME . 'order', array('id' => $id)); + $coupon = pdo_get('wlmerchant_couponlist', array('id' => $v['fkid']), array('title', 'logo')); + $merchant = pdo_get('wlmerchant_merchantdata', array('id' => $v['sid']), array('storename')); + $member = Member::wl_member_get($v['mid'], array('nickname', 'avatar', 'mobile')); + $v['title'] = $coupon['title']; + $v['gimg'] = tomedia($coupon['logo']); + $v['storename'] = $merchant['storename']; + $v['nickname'] = $member['nickname']; + $v['headimg'] = $member['avatar']; + $v['mobile'] = $member['mobile']; + $v['actualprice'] = $v['price']; + $v['gname'] = $v['title']; + $list[] = $v; + } else { + $list[] = Rush::getSingleOrder($id, "*"); + } + } + } + if ($settlementRecord['type'] == 2) { + foreach ($orders as $id) { + $order = Util::getSingelData("*", PDO_NAME . 'vip_record', array('id' => $id)); + $member = Member::wl_member_get($order['mid']); + $order['nickname'] = $member['nickname']; + $order['actualprice'] = $order['price']; + $order['mobile'] = $member['mobile']; + $order['gname'] = 'VIP充值'; + $list[] = $order; + } + } + if ($settlementRecord['type'] == 3) { + foreach ($orders as $id) { + $order = Util::getSingelData("*", PDO_NAME . 'halfcard_record', array('id' => $id)); + $member = Member::wl_member_get($order['mid']); + $order['nickname'] = $member['nickname']; + $order['actualprice'] = $order['price']; + $order['mobile'] = $member['mobile']; + $order['gname'] = '一卡通充值'; + $list[] = $order; + } + } + $orders = $list; + if ($settlementRecord['status'] == 1) + $settleStatus = '代理审核中'; + if ($settlementRecord['status'] == 2) + $settleStatus = '系统审核中'; + if ($settlementRecord['status'] == 3) + $settleStatus = '系统审核通过,待结算'; + if ($settlementRecord['status'] == 4) + $settleStatus = '已结算到代理'; + if ($settlementRecord['status'] == 5) + $settleStatus = '已结算到商家'; + if ($settlementRecord['status'] == -1) + $settleStatus = '系统审核不通过'; + if ($settlementRecord['status'] == -2) + $settleStatus = '代理审核不通过'; + $html = "\xEF\xBB\xBF"; + $filter = array('aa' => '商户单号', 'bb' => '昵称', 'cc' => '电话', 'dd' => '支付金额', 'ee' => '订单状态', 'jj' => '结算状态', 'ff' => '支付时间', 'gg' => '商品名称', 'hh' => '微信订单号'); + foreach ($filter as $key => $title) { + $html .= $title . "\t,"; + } + $html .= "\n"; + foreach ($orders as $k => $v) { + if ($v['status'] == '0') + $thisstatus = '未支付'; + if ($v['status'] == '1') + $thisstatus = '已支付'; + if ($v['status'] == '2') + $thisstatus = '已消费'; + $time = date('Y-m-d H:i:s', $v['paytime']); + $orders[$k]['aa'] = $v['orderno']; + $orders[$k]['bb'] = $v['nickname']; + $orders[$k]['cc'] = $v['mobile']; + $orders[$k]['dd'] = $v['actualprice']; + $orders[$k]['ee'] = $thisstatus; + $orders[$k]['jj'] = $settleStatus; + $orders[$k]['ff'] = $time; + $orders[$k]['gg'] = $v['gname']; + $orders[$k]['hh'] = $v['transid']; + foreach ($filter as $key => $title) { + $html .= $orders[$k][$key] . "\t,"; + } + $html .= "\n"; + } + $str = '未结算订单_' . time(); + header("Content-type:text/csv"); + header("Content-Disposition:attachment; filename={$str}.csv"); + echo $html; + exit(); + + } + /** + * Comment: 打款操作 + * Author: zzw + * Date: 2019/10/9 17:42 + */ + public function settlementing(){ + global $_W, $_GPC; + #1、获取基本参数 + $id = $_GPC['id'] OR show_json(0,'id错误,请刷新重试!'); + $type = $_GPC['type'] OR wl_message(0,'打款类型错误,请刷新重试!');//1=手动处理;2=微信打款;3=分销商提现(手动处理);4=分销商提现(余额到账);5=红包打款;6=支付宝转账 + $phone = $_GPC['phone'];//支付宝提现手机号信息 + $info = pdo_get(PDO_NAME . "settlement_record" , [ 'id' => $id ] + , [ 'type' , 'status' ,'uniacid','sgetmoney' , 'spercent' , 'sapplymoney','spercentmoney','sopenid','sid','aid','mid','trade_no','source']); + #2、先判断是否已结算 + if($info['status'] != 3 && $info['status'] != 8 && $info['status'] != 16) show_json(0,'该申请未审核或已打款'); + #2、结算金额计算,判断提现申请金额是否合法 + $sgetmoney = sprintf("%.2f" , $info['sgetmoney']);//实际结算给商户 + $spercent = sprintf("%.2f" , $info['spercent']); //佣金百分比 + $spercentmoney = sprintf("%.2f" , $info['spercentmoney']);//佣金 + if($sgetmoney <= 0 || !is_numeric($sgetmoney)) show_json(0,'结算金额错误'); + #3、生成基本数据信息 1=商家提现申请;2=代理提现申请;3=分销商申请提现;4=用户余额提现 + $data = [ + 'updatetime' => TIMESTAMP ,//最后操作时间 + 'sgetmoney' => $sgetmoney ,//实际得到金额 + 'spercent' => $spercent ,//系统抽成比例 + 'spercentmoney' => $spercentmoney ,//系统抽成金额 + ]; + switch ($info['type']){ + case 1: + $userName = pdo_getcolumn(PDO_NAME."merchantdata",['id'=>$info['sid']],'storename'); + $rem = '商家提现:'.$userName; + $data['status'] = 5; + $info['mid'] = pdo_getcolumn(PDO_NAME . 'merchantuser', array('storeid' => $info['sid'],'ismain' => 1), 'mid'); + break;//商家提现申请 + case 2: + $userName = pdo_getcolumn(PDO_NAME."agentusers",['id'=>$info['aid']],'agentname'); + $rem = '代理商提现:'.$userName; + $data['status'] = 4; + $info['mid'] = pdo_getcolumn(PDO_NAME . 'member', array('openid' => $info['sopenid']), 'id'); + break;//代理提现申请 + case 3: + $userName = pdo_getcolumn(PDO_NAME."distributor",['mid'=>$info['mid']],'nickname'); + if(Customized::init('distributionText') > 0){ + $rem = '共享股东提现:'.$userName; + }else{ + $rem = '分销商提现:'.$userName; + } + $data['status'] = 9; + break;//分销商申请提现 + case 4: + $userName = pdo_getcolumn(PDO_NAME."member",['id'=>$info['mid']],'nickname'); + $rem = '用户提现:'.$userName; + $data['status'] = 5; + break;//用户余额提现 + case 5: + $userName = pdo_getcolumn(PDO_NAME."member",['id'=>$info['mid']],'nickname'); + $rem = '红娘提现:'.$userName; + $data['status'] = 18; + break;//红娘提现 + } + #3、根据结算类型进行打款结算 微信提现/手动处理/微信红包 + switch ($type){ + case 1:case 3: + $data['settletype'] = 1; + $res = 1;//手动处理直接成功 + $cashtype = '手动处理'; + break;//手动处理 + case 2: + if ($sgetmoney < 1) show_json(0,'实际到账金额需要大于1元'); + $cashtype = '微信零钱'; + if (empty($info['sopenid'])) { + if($info['type'] == 2){ + $info['sopenid'] = pdo_getcolumn(PDO_NAME . 'agentusers', array('id' => $info['aid']), 'cashopenid'); + }else if($info['type'] == 1){ + $mid = pdo_getcolumn(PDO_NAME . 'merchantuser', array('storeid' => $info['sid'],'ismain' => 1), 'mid'); + if($info['source'] == 3){ + $info['sopenid'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $mid), 'wechat_openid'); + if (empty($info['sopenid'])){ + $info['sopenid'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $mid), 'openid'); + } + }else{ + $info['sopenid'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $mid), 'openid'); + if (empty($info['sopenid'])){ + $info['sopenid'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $mid), 'wechat_openid'); + } + } + }else if($info['type'] == 3){ + if($info['source'] == 3){ + $info['sopenid'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $info['mid']), 'wechat_openid'); + if (empty($info['sopenid'])){ + $info['sopenid'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $info['mid']), 'openid'); + } + }else{ + $info['sopenid'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $info['mid']), 'openid'); + if (empty($info['sopenid'])){ + $info['sopenid'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $info['mid']), 'wechat_openid'); + } + } + }else if($info['type'] == 4){ + if($info['source'] == 3){ + $info['sopenid'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $info['mid']), 'wechat_openid'); + if (empty($info['sopenid'])){ + $info['sopenid'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $info['mid']), 'openid'); + } + }else{ + $info['sopenid'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $info['mid']), 'openid'); + if (empty($info['sopenid'])){ + $info['sopenid'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $info['mid']), 'wechat_openid'); + } + } + } + if (empty($info['sopenid'])) { + show_json(0,'该用户未绑定提现微信号'); + } + } + $data['settletype'] = 2; + //请求进行微信打款操作 + $params = [ + 'openid' => $info['sopenid'] , + 'money' => $sgetmoney , + 'rem' => $rem , + 'name' => 'weliam' , + 'order_no' => $info['trade_no'], + 'source' => $info['source'] ? : 1, + 'mid' => $info['mid'] + ]; + $res = Payment::presentationInit($params,1); + if(!$res) $tips = '微信打款失败,请保证微信商户号余额充足并且开通企业付款功能'; + break;//微信打款 + case 4: + //打款到余额 仅分销商可以申请打款到余额 + $data['settletype'] = 4; + $cashtype = '余额到账'; + $res = Member::credit_update_credit2($info['mid'],$info['sgetmoney'],$rem); + break;//余额到账 + case 5: + if ($sgetmoney < 1) show_json(0,'实际到账金额需要大于1元'); + $data['settletype'] = 5; + //请求进行微信打款操作 + $params = [ + 'openid' => $info['sopenid'] , + 'money' => $sgetmoney , + 'rem' => $rem , + 'name' => 'weliam' , + 'order_no' => $info['trade_no'], + 'source' => $info['source'] ? : 1, + 'mid' => $info['mid'] + ]; + $res = Payment::presentationInit($params,2); + if(!$res) $tips = '红包打款失败,请保证微信商户号余额充足'; + $cashtype = '微信红包'; + break;//红包打款 + case 6: + if ($sgetmoney < 1) show_json(0,'实际到账金额需要大于1元'); + if (empty($phone)) show_json(0,'未获取支付宝账号信息'); + $data['settletype'] = 6; + $realname = pdo_getcolumn(PDO_NAME.'member',array('id'=>$info['mid']),'realname'); + //请求进行微信打款操作 + $params = [ + 'money' => $sgetmoney , + 'order_no' => $info['trade_no'], + 'phone' => $phone, + 'source' => $info['source'] ? : 1, + 'mid' => $info['mid'], + 'realname' => $realname + ]; + $res = Payment::presentationInit($params,3); + if(!$res) $tips = '支付宝打款失败,请保证微信账户余额充足并且开通对应功能'; + $cashtype = '支付宝转账'; + break;//支付宝转账 + } + #3、修改提现信息 + if($res){ + pdo_update(PDO_NAME . 'settlement_record' , $data , [ 'id' => $_GPC['id'] ]); + //发送模板消息 + if($info['type'] == 3){ + $url = h5_url('pages/subPages/dealer/withdraw/withdrawrecord',['draw_id'=>$_GPC['id']]); + Distribution::distriNotice($info['mid'],$url,6,0,$info['sapplymoney'],$cashtype); + }else{ + $first = '您的提现申请打款'; + $type = '提现申请'; + $status = '已打款'; + $content = '到账金额:¥'.$info['sgetmoney']; + $remark = '谢谢您对平台的支持'; + News::jobNotice($info['mid'],$first,$type,$content,$status,$remark,time()); + if($info['type'] == 1){ + News::addSysNotice($info['uniacid'],3,$info['sid'],0,$_GPC['id'],1); + } + } + + show_json(1,'已结算给'.str_replace('提现:',':',$rem)); + }else{ + $tips = $tips ? : '结算失败,请刷新重试!'; + show_json(0,$tips); + } + } +} diff --git a/addons/weliam_smartcity/sys/controller/finace/newCash.ctrl.php b/addons/weliam_smartcity/sys/controller/finace/newCash.ctrl.php new file mode 100644 index 0000000..dc720a3 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/finace/newCash.ctrl.php @@ -0,0 +1,248 @@ + $_W['uniacid'], 'aid' => $_W['aid']) : array('uniacid' => $_W['uniacid']); + + $type = trim($_GPC['type']); + $where['status'] = ($type == 'store') ? 1 : 2; + if ($type == 'store') { + if(is_agent()){ + $stores = pdo_getall('wlmerchant_merchantdata',array('uniacid' => $_W['uniacid'],'aid' => $_W['aid']),array('storename','id')); + }else{ + $stores = pdo_getall('wlmerchant_merchantdata',array('uniacid' => $_W['uniacid']),array('storename','id')); + } + } else { + $agents = pdo_getall('wlmerchant_agentusers',array('uniacid' => $_W['uniacid']),array('agentname','id')); + } + + if(is_store()){ + $where['objid'] = $_W['storeid']; + } + + $objid = intval($_GPC['objid']); + if($objid){ + $where['objid'] = $objid; + } elseif($type == 'agent' && is_agent()) { + $where['objid'] = $_W['aid']; + } + + $trade_type = intval($_GPC['trade_type']); + if($trade_type){ + $where['type'] = $trade_type; + } + + $days = (isset($_GPC["days"]) ? intval($_GPC["days"]) : -2); + $todaytime = strtotime(date("Y-m-d")); + $starttime = $todaytime; + $endtime = $starttime + 86399; + if($days > -2){ + if($days == -1 ){ + if(empty($_GPC["addtime"])){ + $days = -2; + }else{ + $starttime = strtotime($_GPC["addtime"]["start"]); + $endtime = strtotime($_GPC["addtime"]["end"]); + $where['createtime>'] = $starttime; + $where['createtime<'] = $endtime; + } + }else{ + $starttime = strtotime("-" . $days . " days",$todaytime); + $where['createtime>'] = $starttime; + } + } + + if($_GPC['outflag']){ + $this -> outCurrent($where); + } + + $records = Util::getNumData('*','wlmerchant_current', $where, 'ID DESC', $pindex, $psize, 1); + $pager = $records[1]; + $records = $records[0]; + foreach ($records as $key => &$re) { + if($re['status'] == 1){ + $re['objname'] = pdo_getcolumn(PDO_NAME . 'merchantdata', array('id' => $re['objid']), 'storename'); + }else if($re['status'] == 2){ + if(empty($re['objid'])){ + $re['objname'] = '总后台'; + }else{ + $re['objname'] = pdo_getcolumn(PDO_NAME.'agentusers',array('id'=>$re['objid']),'agentname'); + } + } + if ($re['type'] == 1) { + $re['typename'] = '抢购订单结算'; + $re['css'] = 'success'; + }else if($re['type'] == 10) { + $re['typename'] = '团购订单结算'; + $re['css'] = 'info'; + } else if ($re['type'] == 2) { + $re['typename'] = '拼团订单结算'; + $re['css'] = 'warning'; + } else if ($re['type'] == 3) { + $re['typename'] = '卡券订单结算'; + $re['css'] = 'success'; + } else if ($re['type'] == 4) { + $re['typename'] = '一卡通订单结算'; + $re['css'] = 'info'; + } else if ($re['type'] == 5) { + $re['typename'] = '掌上信息订单结算'; + $re['css'] = 'success'; + } else if ($re['type'] == 6) { + $re['typename'] = '付费入驻订单结算'; + $re['css'] = 'info'; + } else if ($re['type'] == 7) { + if ($re['fee'] < 0) { + $re['typename'] = '提现申请'; + $re['css'] = 'default'; + } else { + $re['typename'] = '提现申请驳回'; + $re['css'] = 'danger'; + } + }else if ($re['type'] == 8) { + if(Customized::init('distributionText') > 0){ + $re['typename'] = '共享股东订单结算'; + }else{ + $re['typename'] = '分销合伙人订单结算'; + } + $re['css'] = 'warning'; + }else if ($re['type'] == 9) { + $re['typename'] = '商户活动订单结算'; + $re['css'] = 'warning'; + }else if ($re['type'] == -1) { + $re['typename'] = '后台修改'; + $re['css'] = 'default'; + }else if ($re['type'] == 11) { + $re['typename'] = '在线买单'; + $re['css'] = 'warning'; + }else if ($re['type'] == 12) { + $re['typename'] = '砍价订单结算'; + $re['css'] = 'success'; + }else if ($re['type'] == 13) { + $re['typename'] = '同城名片订单结算'; + $re['css'] = 'warning'; + }else if ($re['type'] == 14) { + $re['typename'] = '礼包核销结算'; + $re['css'] = 'warning'; + }else if ($re['type'] == 140) { + $re['typename'] = '同城配送订单结算'; + $re['css'] = 'info'; + }else if ($re['type'] == 15) { + $re['typename'] = '支付返现修改金额'; + $re['css'] = 'warning'; + $re['remark'] = pdo_getcolumn(PDO_NAME.'payback_record',array('id'=>$re['orderid']),'remark'); + }else if ($re['type'] == 150) { + $re['typename'] = '黄页114'; + $re['css'] = 'warning'; + } + } + + include wl_template('finace/currentlist'); + } + //导出账户明细 + public function outCurrent($where){ + global $_W; + $records = Util::getNumData('*','wlmerchant_current', $where, 'ID DESC', 0, 0, 1); + $records = $records[0]; + foreach ($records as $key => &$re) { + $re['createtime'] = "\t".date('Y-m-d H:i:s',$re['createtime'])."\t"; + if($re['status'] == 1){ + $re['objname'] = pdo_getcolumn(PDO_NAME . 'merchantdata', array('id' => $re['objid']), 'storename'); + }else if($re['status'] == 2){ + if(empty($re['objid'])){ + $re['objname'] = '总后台'; + }else{ + $re['objname'] = pdo_getcolumn(PDO_NAME.'agentusers',array('id'=>$re['objid']),'agentname'); + } + } + if ($re['type'] == 1) { + $re['typename'] = '抢购订单结算'; + }else if($re['type'] == 10) { + $re['typename'] = '团购订单结算'; + } else if ($re['type'] == 2) { + $re['typename'] = '拼团订单结算'; + } else if ($re['type'] == 3) { + $re['typename'] = '卡券订单结算'; + } else if ($re['type'] == 4) { + $re['typename'] = '一卡通订单结算'; + } else if ($re['type'] == 5) { + $re['typename'] = '掌上信息订单结算'; + } else if ($re['type'] == 6) { + $re['typename'] = '付费入驻订单结算'; + } else if ($re['type'] == 7) { + if ($re['fee'] < 0) { + $re['typename'] = '提现申请'; + } else { + $re['typename'] = '提现申请驳回'; + } + }else if ($re['type'] == 8) { + if(Customized::init('distributionText') > 0){ + $re['typename'] = '共享股东订单结算'; + }else{ + $re['typename'] = '分销合伙人订单结算'; + } + }else if ($re['type'] == 9) { + $re['typename'] = '商户活动订单结算'; + }else if ($re['type'] == -1) { + $re['typename'] = '后台修改'; + }else if ($re['type'] == 11) { + $re['typename'] = '在线买单'; + }else if ($re['type'] == 12) { + $re['typename'] = '砍价订单结算'; + }else if ($re['type'] == 13) { + $re['typename'] = '同城名片订单结算'; + }else if ($re['type'] == 14) { + $re['typename'] = '礼包核销结算'; + }else if ($re['type'] == 140) { + $re['typename'] = '同城配送订单结算'; + }else if ($re['type'] == 15) { + $re['typename'] = '支付返现修改金额'; + $re['remark'] = pdo_getcolumn(PDO_NAME.'payback_record',array('id'=>$re['orderid']),'remark'); + }else if ($re['type'] == 150) { + $re['typename'] = '黄页114'; + } + } + /* 输出表头 */ + $filter = array( + 'createtime' => '记录时间', + 'objname' => '账户名称', + 'typename' => '类型', + 'fee' => '收入|支出(元)', + 'nowmoney' => '账户余额', + 'remark' => '核销码/备注', + ); + + $data = array(); + foreach ($records as $k => $v) { + foreach ($filter as $key => $title) { + $data[$k][$key] = $v[$key]; + } + } + util_csv::export_csv_2($data,$filter, '金额变更记录表.csv'); + exit; + + } + + //修改备注 + public function editremark(){ + global $_W,$_GPC; + $id = intval($_GPC['id']); + $remark = trim($_GPC['value']); + $type = $_GPC['type']; + if($type == 1){ + $res = pdo_update('wlmerchant_rush_order',array('adminremark' => $remark),array('id' => $id)); + }else{ + $res = pdo_update('wlmerchant_order',array('remark' => $remark),array('id' => $id)); + } + if($res){ + show_json(1, '备注修改成功'); + }else{ + show_json(0, '备注修改失败,请刷新页面重试!'); + } + } + +} diff --git a/addons/weliam_smartcity/sys/controller/finace/wlCash.ctrl.php b/addons/weliam_smartcity/sys/controller/finace/wlCash.ctrl.php new file mode 100644 index 0000000..1dfda15 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/finace/wlCash.ctrl.php @@ -0,0 +1,95 @@ + 0){ //分账 + // if($set['wxsysalltype'] == 1){ + // if(empty($set['wxmerchantid'])){ + // show_json(0,'请设置公众号平台分账商户号'); + // } + // if(empty($set['wxmerchantname'])){ + // show_json(0,'请设置公众号平台分账商户名称'); + // } + // }else if($set['wxsysalltype'] == 2){ + // if(empty($set['wxallmid'])){ + // show_json(0,'请设置公众号平台分账个人微信号'); + // }else{ + // $member = pdo_get('wlmerchant_member',array('id' => $set['wxallmid']),array('openid')); + // if(empty($member['openid'])){ + // show_json(0,'所选用户无微信公众号账户信息,请重选'); + // } + // } + // } + // if($set['appsysalltype'] == 1){ + // if(empty($set['appmerchantid'])){ + // show_json(0,'请设置小程序平台分账商户号'); + // } + // if(empty($set['appmerchantname'])){ + // show_json(0,'请设置小程序平台分账商户名称'); + // } + // }else if($set['appsysalltype'] == 2){ + // if(empty($set['appallmid'])){ + // show_json(0,'请设置小程序平台分账个人微信号'); + // }else{ + // $member = pdo_get('wlmerchant_member',array('id' => $set['appallmid']),array('wechat_openid')); + // if(empty($member['wechat_openid'])){ + // show_json(0,'所选用户无微信小程序账户信息,请重选'); + // } + // } + // } + }else{ + if($set['maxsetmoney'] > 0 && $set['maxsetmoney'] < $set['lowsetmoney']){ + show_json(0,'最大提现金额必须大于最小提现金额'); + } + } + + $res1 = Setting::wlsetting_save($set, 'cashset'); + if ($res1) { + show_json(1); + } else { + show_json(0,'保存设置失败,请重试'); + } + } + //获取设置信息 + $cashset = Setting::wlsetting_read('cashset'); + #1、获取微信支付方式列表 + $weChat = pdo_getall(PDO_NAME."payment",['uniacid'=>$_W['uniacid'],'type'=>1],['id','name']); + #2、获取支付宝支付方式列表 + $aliPay = pdo_getall(PDO_NAME."payment",['uniacid'=>$_W['uniacid'],'type'=>2],['id','name']); + //校验权限 + $isAuth = Customized::init('allocation'); + + include wl_template('finace/cashset'); + } +} diff --git a/addons/weliam_smartcity/sys/controller/member/campusActivities.ctrl.php b/addons/weliam_smartcity/sys/controller/member/campusActivities.ctrl.php new file mode 100644 index 0000000..3f2380c --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/member/campusActivities.ctrl.php @@ -0,0 +1,200 @@ + 128) wl_message('活动标题不得超过128个字符','refresh','error'); + if (empty($data['describe'])) wl_message('请填写活动描述','refresh','error'); + if (empty($data['promotional_img'])) wl_message('请填写上传活动宣传图','refresh','error'); + + $data['uniacid'] = $_W['uniacid']; + $data['title'] = trim($data['title']); + $data['recommend'] = $data['recommend'] ?: 0; + $data['promotional_img'] = trim($data['promotional_img']); + $data['describe'] = htmlspecialchars_decode($data['describe']); + + $where = ['title' => $data['title']]; + if ($id) $where['id!='] = $id; + $query_res = pdo_get(PDO_NAME . 'member_campus_activities',$where); + if ($query_res) wl_message('该活动标题已存在,请换一个','refresh','error'); + + if (empty($id)) { + $data['create_user_id'] = $_W['uid']; + $data['create_time'] = time(); + $result = pdo_insert(PDO_NAME . 'member_campus_activities',$data); + } else { + $data['update_time'] = time(); + $result = pdo_update(PDO_NAME . 'member_campus_activities',$data,['id' => $id]); + } + + if (!$result) wl_message('活动保存失败,请重试', web_url('member/campus_activities/edit',['id' => $id]), 'error'); + + wl_message('活动保存成功',web_url('member/campusActivities/index',['active' => 1]),'success'); + } + + $register = []; + if (!empty($id)) { + $register = pdo_get(PDO_NAME . 'member_campus_activities', ['id' => $id]); + } + + $category = Category::getChildCategoryAll(6,'*',true); + + include wl_template('member/campus_activities/edit'); + } + + public function publish() { + global $_W, $_GPC; + + $id = $_GPC['id']; + if (empty($id) || !is_numeric($id)) show_json(0,'参数错误'); + $data = [ + 'status' => 1, + 'publish_time' => time(), + 'publish_user_id' => $_W['uid'] + ]; + $result = pdo_update(PDO_NAME . 'member_campus_activities',$data,['id' => $id]); + if (!$result) show_json(0,'发布失败'); + show_json(1,['message' => '发布成功','button' => '已发布']); + } + + public function reject() { + global $_W, $_GPC; + + $id = $_GPC['id']; + $reject = $_GPC['reject']; + if (empty($id) || !is_numeric($id)) wl_message('参数错误'); + if (empty($reject)) wl_message('驳回原因不能为空'); + $data = ['status' => 2,'reject' => $reject]; + $result = pdo_update(PDO_NAME . 'member_campus_activities',$data,['id' => $id]); + if (!$result) wl_message('驳回失败'); + wl_message('驳回成功',web_url('member/campusActivities/index',['active' => 1]),'success'); + } + + public function delete() { + global $_W, $_GPC; + + $id = $_GPC['id']; + if (empty($id) || !is_numeric($id)) show_json(0,'参数错误'); + $del_res = pdo_delete(PDO_NAME . 'member_campus_activities',['id' => $id]); + if (!$del_res) { + show_json(0,'删除失败'); + } + pdo_delete(PDO_NAME . 'member_evaluation_activities',['campus_activities_id' => $id]); + + show_json(1,'删除成功'); + } + + /** + * Comment: 修改状态 + * Author: zzw + * Date: 2023/5/6 13:52 + */ + public function changeRecommend() + { + global $_W, $_GPC; + #1、获取参数信息 + $id = $_GPC['id'] or Commons::sRenderError('缺少参数:导航id'); + $recommend = $_GPC['status'] ?: 0; + #1、修改操作 + $res = pdo_update(PDO_NAME . "member_campus_activities", ['recommend' => $recommend], ['id' => $id]); + if ($res) Commons::sRenderSuccess('修改成功'); + else Commons::sRenderError('修改失败,请刷新重试!'); + } + + public function commentIndex() + { + global $_W, $_GPC; + + $where = []; + $pindex = max(1, intval($_GPC['page'])); + $psize = 10; + + if (is_numeric($_GPC['status'])) $where['status'] = $_GPC['status']; + + $pageData = Util::getNumData("*", PDO_NAME . 'member_evaluation_activities', $where, 'status asc,create_time asc', $pindex, $psize, 1); + $list = $pageData[0]; + $pager = $pageData[1]; + + foreach ($list as &$item) { + + Member::getMemberInfo($item,$item['mid']); + if (is_base64($item['content'])) $item['content'] = base64_decode($item['content']); + $item['create_time'] = date("Y-m-d H:i:s",$item['create_time']); + + } + + include wl_template('member/campus_activities/commentIndex'); + } + + public function checkComment() + { + global $_W, $_GPC; + $id = $_GPC['id']; + if (empty($id)) { + wl_message('缺少参数:id',web_url('member/campusActivities/commentIndex',['active' => 2]),'error'); + } + $status = $_GPC['status']; + if (empty($status)) { + wl_message('缺少参数:status',web_url('member/campusActivities/commentIndex',['active' => 2]),'error'); + } + $updateArr = ['status' => $status]; + $checkRes = pdo_update(PDO_NAME . 'member_evaluation_activities',$updateArr,['id' => $id]); + if (!$checkRes) wl_message('审核失败',web_url('member/campusActivities/commentIndex',['active' => 2]),'error'); + wl_message('审核成功',web_url('member/campusActivities/commentIndex',['active' => 2]),'success'); + } + + public function deleteComment() + { + global $_W, $_GPC; + + if (Member::commentDelete($_GPC['id'])) wl_message('删除成功', web_url('member/campusActivities/commentIndex',['active' => 2]), 'success'); + + wl_message('删除失败', referer(), 'error'); + } +} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/controller/member/checkMember.ctrl.php b/addons/weliam_smartcity/sys/controller/member/checkMember.ctrl.php new file mode 100644 index 0000000..d2e0749 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/member/checkMember.ctrl.php @@ -0,0 +1,300 @@ + $id]); + if (!$result) wl_message('编辑失败'); + + wl_message('编辑成功', web_url('member/checkMember/checkStudentIndex'), 'success'); + } + + $data = pdo_get(PDO_NAME . 'member_student_info',['id' => $id]); + + include wl_template('member/check/checkStudentEdit'); + } + + /* + * 学历认证审核审核 + */ + public function checkStudentInfo() { + global $_W, $_GPC; + + if ($_W['ispost']) { + $id = $_GPC['data']['id']; + $check_result = $_GPC['data']['result']; + $reason = $_GPC['data']['reason']?:''; + if (!in_array($check_result,['reject','pass'])) show_json(0,'参数错误'); + if ($check_result == 'reject' && empty($reason)) show_json(0,'请填写不通过的原因'); + + $query_res = pdo_get(PDO_NAME . 'member_student_info',['id' => $id, 'check_status' => 0]); + if (!$query_res) show_json(0,'已审核,请勿重复审核'); + + $check_status = $check_result == 'pass' ? 1 : 2; + $update_arr = [ + 'check_status' => $check_status, + 'check_cause' => $reason, + 'check_user_id' => $_W['uid'], + 'check_time' => time(), + ]; + pdo_begin(); // 开始事务 + $up_res = pdo_update(PDO_NAME . 'member_student_info',$update_arr,['id' => $id]); + + if (!$up_res) { + pdo_rollback(); // 回滚 + show_json(0,'失败'); + } + + // 通过修改为学生身份 + if ($check_status == 1) { + $up_res2 = pdo_update(PDO_NAME . 'member',['identity_id' => 2],['id' => $query_res['mid']]); + if (!$up_res2) { + pdo_rollback(); // 回滚 + show_json(0,'失败'); + } + } else { + $content = '驳回原因:' . truncate_chinese_string($reason) . '...'; + $link = h5_url('pagesA/studentIdentification/studentIdentification'); + News::jobNotice($query_res['mid'], '您好,您的学生认证审核已完成', '学生认证审核通知', $content, '未通过', '点击重新申请', time(), $link); + } + + pdo_commit(); // 提交事务 + show_json(1,['message' => '成功', 'span' => $check_result == 'pass' ? '审核通过' : '审核失败']); + } + show_json(0,'请求失败'); + } + + /* + * 教师认证列表 + */ + public function checkTeacherIndex() + { + global $_W, $_GPC; + + $where = []; + $pindex = max(1, intval($_GPC['page'])); + $psize = 10; + + if (!empty($_GPC['keyword'])) { + if ($_GPC['keywordtype'] == 1) { + $where['mid'] = trim($_GPC['keyword']); + } else if ($_GPC['keywordtype'] == 2) { + $memberIdArr = []; + $memberAll = pdo_getall(PDO_NAME . 'member',['nickname like' => '%'.trim($_GPC['keyword']).'%'],'id'); + foreach ($memberAll as $memberRow) $memberIdArr[] = $memberRow['id']; + $where['mid#'] = $memberIdArr ? implode(",",$memberIdArr) : '0'; + } else if ($_GPC['keywordtype'] == 3) { + $where['@name@'] = trim($_GPC['keyword']); + } + } + + if (is_numeric($_GPC['status'])) $where['status'] = trim($_GPC['status']); + + $memberData = Util::getNumData("*", PDO_NAME . 'member_teacher_certified', $where, 'id desc', $pindex, $psize, 1); + $list = $memberData[0]; + $pager = $memberData[1]; + foreach ($list as &$item) { + $member = Member::getMemberInfo($item,$item['mid']); + $item['documents'] = tomedia($item['documents']); + $item['create_time'] = date("Y-m-d H:i:s",$item['create_time']); + } + + include wl_template('member/check/checkTeacherIndex'); + } + + /* + * 教师信息认证 + */ + public function checkTeacherInfo() { + global $_W, $_GPC; + + if ($_W['ispost']) { + + try { + + $id = $_GPC['data']['id']; + $check_result = $_GPC['data']['result']; + $reason = $_GPC['data']['reason']?:''; + if (empty($id) || !is_numeric($id)) show_json('缺少id参数'); + if (!in_array($check_result,['reject','pass'])) show_json(0,'参数错误'); + if ($check_result == 'reject' && empty($reason)) show_json(0,'请填写不通过的原因'); + + $query_res = pdo_get(PDO_NAME . 'member_teacher_certified',['id' => $id, 'status' => 0]); + if (!$query_res) show_json(0,'已审核,请勿重复审核'); + + $status = $check_result == 'pass' ? 1 : 2; + $update_arr = [ + 'status' => $status, + 'remark' => $reason, + 'certified_userid' => $_W['uid'], + 'certified_time' => time() + ]; + + pdo_begin(); // 开始事务 + $up_res = pdo_update(PDO_NAME . 'member_teacher_certified',$update_arr,['id' => $id]); + + if (!$up_res) throw new Exception('失败'); + + // 通过修改为教师身份 + if ($status == 1) { + $up_res2 = pdo_update(PDO_NAME . 'member',['identity_id' => 6],['id' => $query_res['mid']]); + if (!$up_res2) throw new Exception('失败'); + } else { + $content = '驳回原因:' . truncate_chinese_string($reason) . '...'; + $link = h5_url('pagesA/identityList/teacherCertification'); + News::jobNotice($query_res['mid'], '您好,您的教师认证审核已完成', '教师认证审核通知', $content, '未通过', '点击重新申请', time(), $link); + } + + pdo_commit(); // 提交事务 + + show_json(1,['message' => '成功', 'span' => $check_result == 'pass' ? '认证成功' : '认证失败']); + } catch (Exception $e) { + pdo_rollback(); // 回滚 + show_json(0,$e->getMessage()); + } + + } + show_json(0,'请求失败'); + } + + /* + * 达人认证列表 + */ + public function checkBloggerIndex() + { + global $_W, $_GPC; + + $where = []; + $pindex = max(1, intval($_GPC['page'])); + $psize = 10; + + if (!empty($_GPC['keyword'])) { + if ($_GPC['keywordtype'] == 1) { + $where['storeid'] = trim($_GPC['keyword']); + } else if ($_GPC['keywordtype'] == 2) { + $memberIdArr = []; + $memberAll = pdo_getall(PDO_NAME . 'member',['nickname like' => '%'.trim($_GPC['keyword']).'%'],'id'); + foreach ($memberAll as $memberRow) $memberIdArr[] = $memberRow['id']; + $where['mid#'] = $memberIdArr ? implode(",",$memberIdArr) : '0'; + } else if ($_GPC['keywordtype'] == 3) { + $where['@name@'] = trim($_GPC['keyword']); + } else if ($_GPC['keywordtype'] == 4) { + $where['mobile'] = trim($_GPC['keyword']); + } + } + + if (is_numeric($_GPC['status'])) $where['status'] = trim($_GPC['status']); + + $memberData = Util::getNumData("*", PDO_NAME . 'member_daren_certified', $where, 'id desc', $pindex, $psize, 1); + $list = $memberData[0]; + $pager = $memberData[1]; + foreach ($list as &$item) { + $member = Member::getMemberInfo($item,$item['mid']); + $item['screenshot'] = tomedia($item['screenshot']); + $item['create_time'] = date("Y-m-d H:i:s",$item['create_time']); + } + + include wl_template('member/check/checkBloggerIndex'); + } + + /* + * 达人信息认证 + */ + public function checkBloggerInfo() { + global $_W, $_GPC; + + if ($_W['ispost']) { + + try { + + $id = $_GPC['data']['id']; + $check_result = $_GPC['data']['result']; + $reason = $_GPC['data']['reason']?:''; + if (empty($id) || !is_numeric($id)) show_json('缺少id参数'); + if (!in_array($check_result,['reject','pass'])) show_json(0,'参数错误'); + if ($check_result == 'reject' && empty($reason)) show_json(0,'请填写不通过的原因'); + + $query_res = pdo_get(PDO_NAME . 'member_daren_certified',['id' => $id, 'status' => 0]); + if (!$query_res) show_json(0,'已审核,请勿重复审核'); + + $status = $check_result == 'pass' ? 1 : 2; + $update_arr = [ + 'status' => $status, + 'remark' => $reason, + 'certified_userid' => $_W['uid'], + 'certified_time' => time() + ]; + + pdo_begin(); // 开始事务 + $up_res = pdo_update(PDO_NAME . 'member_daren_certified',$update_arr,['id' => $id]); + + if (!$up_res) throw new Exception('失败'); + + // 通过修改为达人身份 + if ($status == 1) { + $up_res2 = pdo_update(PDO_NAME . 'member',['identity_id' => 7],['id' => $query_res['mid']]); + if (!$up_res2) throw new Exception('失败'); + } else { + $content = '驳回原因:' . truncate_chinese_string($reason) . '...'; + $link = h5_url('pagesA/identityList/bloggerCertification'); + News::jobNotice($query_res['mid'], '您好,您的达人认证审核已完成', '达人认证审核通知', $content, '未通过', '点击重新申请', time(), $link); + } + + pdo_commit(); // 提交事务 + + show_json(1,['message' => '成功', 'span' => $check_result == 'pass' ? '认证成功' : '认证失败']); + } catch (Exception $e) { + pdo_rollback(); // 回滚 + show_json(0,$e->getMessage()); + } + + } + show_json(0,'请求失败'); + } +} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/controller/member/memberFinancialDetails.ctrl.php b/addons/weliam_smartcity/sys/controller/member/memberFinancialDetails.ctrl.php new file mode 100644 index 0000000..59e27fd --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/member/memberFinancialDetails.ctrl.php @@ -0,0 +1,291 @@ +'] = $starttime; + $where['createtime<'] = $endtime; + } + + if($_GPC['export']){ + $this -> exportRecharge($where); + } + + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + + $details = Util::getNumData('orderno,paytype,mid,paytime,price', PDO_NAME . 'order', $where, 'ID DESC', $pindex, $psize, 1); + $pager = $details[1]; + $details = $details[0]; + if ($details) { + foreach ($details as $key => &$det) { + $member = Member::wl_member_get($det['mid'], array('nickname', 'avatar','encodename')); + $det['nickname'] = $member['nickname']; + $det['avatar'] = tomedia($member['avatar']); + $det['paytime'] = date('Y-m-d H:i:s', $det['paytime']); + } + } + + include wl_template('member/rechargelist'); + } + //积分明细 + public function integral() { + global $_W, $_GPC; + #1、获取基本参数 + $pindex = max(1, intval($_GPC['page'])); + $psize = 20; + $keyword = $_GPC['keyword'];//关键字 + $keywordtype = $_GPC['keywordtype'];//关键字类型 + $type = $_GPC['type'];//类型 + $timeLimit = $_GPC['time_limit'];//时间段 + #2、获取条件信息 + $where = " a.credittype = 'credit1' AND a.uniacid = {$_W['uniacid']} "; + if ($type) { + if ($type == 1) { + $where .= " AND a.num >= 0 "; + } else { + $where .= " AND a.num <= 0 "; + } + } + if ($timeLimit) { + $starttime = strtotime($timeLimit['start']); + $endtime = strtotime($timeLimit['end']); + $where .= " AND a.createtime >= {$starttime} "; + $where .= " AND a.createtime <= {$endtime} "; + } + if ($keyword) { + if ($keywordtype == 1) { + $where .= " AND b.id LIKE '%{$keyword}%'"; + } else if ($keywordtype == 2) { + $where .= " AND b.nickname LIKE '%{$keyword}%'"; + } else if ($keywordtype == 3) { + $where .= " AND b.mobile LIKE '%{$keyword}%'"; + } + } + + if($_GPC['export']){ + $this -> exportIntegral($where); + } + + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + $start = $pindex * $psize - $psize; + $limit = " LIMIT {$start},{$psize} "; + #3、获取信息数据 + $sql = "SELECT a.id,a.num,a.createtime,a.uid,a.remark,b.nickname,b.avatar,b.encodename FROM " + . tablename("mc_credits_record") + . " a LEFT JOIN " . tablename(PDO_NAME . "member") . " b ON a.uid = b.uid WHERE {$where} AND b.id > 0 ORDER BY createtime DESC"; + $total = pdo_fetchcolumn('SELECT count(*) FROM '.tablename('mc_credits_record') . " a LEFT JOIN " . tablename(PDO_NAME . "member") . " b ON a.uid = b.uid WHERE {$where} AND b.id > 0"); + //wl_debug($total); + $details = pdo_fetchall($sql . $limit); + if ($details) { + foreach ($details as $key => &$det) { + $det['avatar'] = tomedia($det['avatar']); + $det['nickname'] = base64_decode($det['encodename']); + $det['createtime'] = date('Y-m-d H:i:s', $det['createtime']); + } + } + $pager = wl_pagination($total, $pindex, $psize); + include wl_template('member/integrallist'); + } + //余额明细 + public function balance() { + global $_W, $_GPC; + #1、获取基本参数 + $pindex = max(1, intval($_GPC['page'])); + $psize = 20; + $keyword = $_GPC['keyword'];//关键字 + $keywordtype = $_GPC['keywordtype'];//关键字类型 + $type = $_GPC['type'];//类型 + $timeLimit = $_GPC['time_limit'];//时间段 + #2、获取条件信息 + $where = " a.credittype = 'credit2' AND a.uniacid = {$_W['uniacid']} AND b.uniacid = {$_W['uniacid']} "; + if ($type) { + if ($type == 1) { + $where .= " AND a.num >= 0 "; + } else { + $where .= " AND a.num <= 0 "; + } + } + if ($timeLimit) { + $starttime = strtotime($timeLimit['start']); + $endtime = strtotime($timeLimit['end']); + $where .= " AND a.createtime >= {$starttime} "; + $where .= " AND a.createtime <= {$endtime} "; + } + if ($keyword) { + if ($keywordtype == 1) { + $where .= " AND b.id LIKE '%{$keyword}%'"; + } else if ($keywordtype == 2) { + $where .= " AND b.nickname LIKE '%{$keyword}%'"; + } else if ($keywordtype == 3) { + $where .= " AND b.mobile LIKE '%{$keyword}%'"; + } + } + if($_GPC['export']){ + $this -> exportBalance($where); + } + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + $start = $pindex * $psize - $psize; + $limit = " LIMIT {$start},{$psize} "; + + #3、获取信息数据 + $sql = "SELECT a.id,a.num,a.createtime,a.uid,a.remark,b.nickname,b.avatar,b.encodename FROM " + . tablename("mc_credits_record") + . " a LEFT JOIN " . tablename(PDO_NAME . "member") . " b ON a.uid = b.uid WHERE {$where} AND b.id > 0 ORDER BY createtime DESC"; + $total = pdo_fetchcolumn('SELECT count(a.id) FROM ' . tablename('mc_credits_record') . " a LEFT JOIN " . tablename(PDO_NAME . "member") . " b ON a.uid = b.uid WHERE {$where} AND b.id > 0 "); + $details = pdo_fetchall($sql . $limit); + if ($details) { + foreach ($details as $key => &$det) { + $det['avatar'] = tomedia($det['avatar']); + $det['nickname'] = base64_decode($det['encodename']); + $det['createtime'] = date('Y-m-d H:i:s', $det['createtime']); + } + } + $pager = wl_pagination($total, $pindex, $psize); + include wl_template('member/balancelist'); + } + + public function exportBalance($where){ + global $_W, $_GPC; + $limit = " LIMIT 20000"; + $sql = "SELECT a.id,a.num,a.createtime,a.uid,a.remark,b.nickname,b.id as mid FROM " + . tablename("mc_credits_record") + . " a LEFT JOIN " . tablename(PDO_NAME . "member") . " b ON a.uid = b.uid WHERE {$where} AND b.id > 0 ORDER BY createtime DESC"; + $total = pdo_fetchcolumn('SELECT count(a.id) FROM ' . tablename('mc_credits_record') . " a LEFT JOIN " . tablename(PDO_NAME . "member") . " b ON a.uid = b.uid WHERE {$where} AND b.id > 0 "); + $details = pdo_fetchall($sql . $limit); + if ($details) { + foreach ($details as $key => &$det) { + $det['createtime'] = date('Y-m-d H:i:s', $det['createtime']); + } + } + + /* 输出表头 */ + $filter = array( + 'mid' => '用户mid',//U + 'nickname' => '用户昵称',//A + 'num' => '变更数量',//B + 'remark' => '变更详情',//C + 'createtime' => '变更时间',//D + ); + + $data = array(); + for ($i=0; $i < count($details) ; $i++) { + foreach ($filter as $key => $title) { + $data[$i][$key] = $details[$i][$key]; + } + } + util_csv::export_csv_2($data, $filter, '余额变更记录表.csv'); + exit(); + + } + + public function exportIntegral($where){ + global $_W, $_GPC; + $limit = " LIMIT 20000"; + $sql = "SELECT a.id,a.num,a.createtime,a.uid,a.remark,b.nickname,b.id as mid FROM " + . tablename("mc_credits_record") + . " a LEFT JOIN " . tablename(PDO_NAME . "member") . " b ON a.uid = b.uid WHERE {$where} AND b.id > 0 ORDER BY createtime DESC"; + $total = count(pdo_fetchall($sql)); + $details = pdo_fetchall($sql . $limit); + if ($details) { + foreach ($details as $key => &$det) { + $det['createtime'] = date('Y-m-d H:i:s', $det['createtime']); + } + } + /* 输出表头 */ + $filter = array( + 'mid' => '用户mid',//U + 'nickname' => '用户昵称',//A + 'num' => '变更数量',//B + 'remark' => '变更详情',//C + 'createtime' => '变更时间',//D + ); + $data = array(); + for ($i=0; $i < count($details) ; $i++) { + foreach ($filter as $key => $title) { + $data[$i][$key] = $details[$i][$key]; + } + } + util_csv::export_csv_2($data, $filter, '积分变更记录表.csv'); + exit(); + } + + public function exportRecharge($where){ + global $_W, $_GPC; + $details = Util::getNumData('orderno,paytype,mid,paytime,price', PDO_NAME . 'order', $where, 'ID DESC', 0, 0, 1); + $details = $details[0]; + if ($details) { + foreach ($details as $key => &$det) { + $member = Member::wl_member_get($det['mid'], array('nickname', 'avatar')); + $det['nickname'] = $member['nickname']; + $det['avatar'] = tomedia($member['avatar']); + $det['paytime'] = date('Y-m-d H:i:s', $det['paytime']); + $det['orderno'] = "\t".$det['orderno']."\t"; + } + } + /* 输出表头 */ + $filter = array( + 'orderno' => '充值单号', + 'mid' => '用户mid',//U + 'nickname' => '用户昵称',//A + 'price' => '充值金额',//B + 'paytype' => '支付方式',//C + 'paytime' => '充值时间',//D + ); + + $data = array(); + for ($i=0; $i < count($details) ; $i++) { + foreach ($filter as $key => $title) { + if($key == 'paytype'){ + switch ($details[$i][$key]) { + case '2': + $data[$i][$key] = '微信支付'; + break; + case '3': + $data[$i][$key] = '支付宝'; + break; + default: + $data[$i][$key] = '其他方式'; + break; + } + }else{ + $data[$i][$key] = $details[$i][$key]; + } + } + } + util_csv::export_csv_2($data, $filter, '充值记录表.csv'); + exit(); + } + + +} diff --git a/addons/weliam_smartcity/sys/controller/member/userIm.ctrl.php b/addons/weliam_smartcity/sys/controller/member/userIm.ctrl.php new file mode 100644 index 0000000..a83a0f2 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/member/userIm.ctrl.php @@ -0,0 +1,190 @@ + &$val){ + //发送方类型1=用户;2=商户 + if($val['send_type'] == 1) $val['send_type_text'] = '用户'; + else if($val['send_type'] == 2) $val['send_type_text'] = '商户'; + //接收人类型1=用户;2=商户 + if($val['receive_type'] == 1) $val['receive_type_text'] = '用户'; + else if($val['receive_type'] == 2) $val['receive_type_text'] = '商户'; + //图片信息处理 + $val['send_logo'] = tomedia($val['send_logo']); + $val['receive_logo'] = tomedia($val['receive_logo']); + $val['new_send_user'] = $val['send_user']; + if ($val['send_encodename']) $val['send_user'] = base64_decode($val['send_encodename']); + if ($val['receive_encodename']) $val['receive_user'] = base64_decode($val['receive_encodename']); + //信息处理 + if(is_base64($val['content'])) { + $val['content'] = base64_decode($val['content'],true); + $val['content'] = strip_tags($val['content']); + } + switch ($val['type']){ + case 1: $val['content'] = '[图片]';break; + case 2: $val['content'] = '[视频]';break; + case 3: $val['content'] = '[名片]';break; + case 4: $val['content'] = '[简历]';break; + case 5: $val['content'] = '[其他]';break; + } + //删除多余的信息 + unset($val['send_type']); + unset($val['receive_type']); + } + //分页操作 + $totalSql = str_replace($field,'count(*)',$sql); + $total = pdo_fetchcolumn($totalSql.$where.$order); + $pager = pagination($total , $page , $pageIndex); + + include wl_template('member/im/index'); + } + /** + * Comment: 获取通讯记录详细信息 + * Author: zzw + * Date: 2020/9/10 10:00 + */ + public function record(){ + global $_W,$_GPC; + //参数信息获取 + $id = $_GPC['id'] OR show_json(0, '参数错误,请刷新重试!'); + $page = max(1, intval($_GPC['page'])); + $pageIndex = 10; + if($_W['ispost']){ + //获取当前通讯记录信息 + $info = pdo_get(PDO_NAME."im",['id'=>$id],['send_id','send_type','receive_id','receive_type']); + $data = Im::imRecord($page,$pageIndex,$info); + //信息排序 + $sortArr = array_column($data['list'], 'create_time'); + array_multisort($sortArr, SORT_ASC, $data['list']); + //循环处理信息 + foreach($data['list'] as $index => &$item){ + //获取名片和简历信息 内容类型:0=文本内容,1=图片信息,2=视频信息,3=名片信息,4=简历信息,5=其他信息(数组) + if($item['type'] == 3){ + //名片信息 + $field = ['name','logo','position','company','branch']; + $card = pdo_get(PDO_NAME."citycard_lists",['id' => $item['content']],$field); + $card['logo'] = tomedia($card['logo']); + $item['other'] = $card; + }else if($item['type'] == 4){ + //简历信息 + $field = ['name','avatar','birth_time','experience_label_id','education_label_id','expect_position']; + $resume = pdo_get(PDO_NAME."recruit_resume",['id' => $item['content']],$field); + $resume = Recruit::handleResumeInfo($resume); + $resume['name'] = mb_substr($resume['name'],0,1); + //删除多余的内容 + unset($resume['birth_time'],$resume['experience_label_id'],$resume['education_label_id'],$resume['expect_position']); + + $item['other'] = $resume; + } + } + + Commons::sRenderSuccess("通讯记录列表",$data); + } + + include wl_template('member/im/record'); + } + /** + * Comment: 删除单条通讯信息 + * Author: zzw + * Date: 2020/9/10 10:24 + */ + public function deleteOneInfo(){ + global $_W,$_GPC; + //参数信息获取 + $id = $_GPC['id'] OR show_json(0, '参数错误,请刷新重试!'); + //开始进行删除操作 + pdo_delete(PDO_NAME."im",['id'=>$id]); + + show_json(1); + } + /** + * Comment: 清除某个对话的所有通信信息 + * Author: zzw + * Date: 2020/9/10 11:27 + */ + public function clearRecord(){ + global $_W,$_GPC; + //参数信息获取 + $id = $_GPC['id'] OR show_json(0, '参数错误,请刷新重试!'); + //信息获取 + $info = pdo_get(PDO_NAME."im",['id'=>$id],['send_id','receive_id']); + //删除操作 + $res = Im::deleteRecord($info['send_id'],$info['receive_id']); + if($res) show_json(1, '操作成功!'); + else show_json(0, '清除失败,请刷新重试!'); + } + /** + * Comment: 通信设置 + * Author: zzw + * Date: 2021/3/8 10:59 + */ + public function imSet(){ + global $_W,$_GPC; + $name = 'im_set'; + if($_W['ispost']){ + $data = $_GPC['data']; + + Setting::wlsetting_save($data,$name); + wl_message('设置成功!' , referer() , 'success'); + } + //获取已存在的设置信息 + $set = Setting::wlsetting_read($name); + + include wl_template('member/im/set'); + } + + + +} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/controller/member/userlabel.ctrl.php b/addons/weliam_smartcity/sys/controller/member/userlabel.ctrl.php new file mode 100644 index 0000000..46ebc43 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/member/userlabel.ctrl.php @@ -0,0 +1,59 @@ + $newvalue), array('id' => $id)); + } elseif ($type == 2) { + $res = pdo_update('wlmerchant_userlabel', array('sort' => $newvalue), array('id' => $id)); + } elseif ($type == 3) { + $res = pdo_update('wlmerchant_userlabel', array('status' => $newvalue), array('id' => $id)); + } else if ($type == 4) { + $res = pdo_delete('wlmerchant_userlabel', array('id' => $id)); + } + if ($res) { + show_json(1, '修改成功'); + } else { + show_json(0, '修改失败,请重试'); + } + } +} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/controller/member/wlMember.ctrl.php b/addons/weliam_smartcity/sys/controller/member/wlMember.ctrl.php new file mode 100644 index 0000000..1c7000d --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/member/wlMember.ctrl.php @@ -0,0 +1,816 @@ +time())); +// $allmembers = pdo_fetchall("select id,openid from `ims_wlmerchant_member` WHERE `openid` in ( select `openid` from `ims_wlmerchant_member` group by `openid` having count(`openid`)>1);"); +// $newdata = []; +// foreach ($allmembers as $key => $allmember) { +// if (!empty($allmember['openid'])) { +// $delmember = pdo_getall('wlmerchant_member', array('openid' => $allmember['openid'], 'uniacid' => $_W['uniacid']), ['id', 'openid', 'uniacid']); +// if (count($delmember) >= 1) { +// pdo_delete('wlmerchant_member', ['id' => $delmember[1]['id']]); +// $newdata[] = $delmember; +// } +// } +// } + $start = ($_GPC["start"] ? strtotime($_GPC["start"]) : strtotime(date("Y-m"))); + $end = ($_GPC["end"] ? strtotime($_GPC["end"]) + 86399 : strtotime(date("Y-m-d")) + 86399); + $day_num = ($end - $start) / 86400; + + if ($_W['isajax']) { + $days = array(); + for ($i = 0; $i < $day_num; $i++) { + $key = date("m-d", $start + 86400 * $i); + $days[$key] = 0; + } + $where = $_W['aid'] ? " AND aid = " . $_W['aid'] : ''; + + $data = pdo_fetchall("SELECT createtime FROM " . tablename("wlmerchant_member") . "WHERE uniacid = :uniacid AND createtime >= :starttime and createtime <= :endtime" . $where, array(":uniacid" => $_W["uniacid"], ":starttime" => $start, ":endtime" => $end)); + foreach ($data as $da) { + $key = date("m-d", $da["createtime"]); + if (in_array($key, array_keys($days))) { + $days[$key]++; + } + } + + $newdata = array(); + foreach ($days as $k => $val) { + $newdata[] = array('day' => $k, '新增客户' => $val); + } + + die(json_encode($newdata)); + } + + $stat = Merchant::sysMemberSurvey(); + + include wl_template('member/summary'); + } + //客户列表 + public function memberIndex() { + global $_W, $_GPC; + $where = $_W['aid'] ? ['aid' => $_W['aid']] : []; + static $account_api; + if (empty($account_api)) { + $account_api = WeAccount::create(); + } + $pindex = max(1, intval($_GPC['page'])); + $psize = 10; + if ($_GPC['keyword'] && $_GPC['type']) { + if (!empty($_GPC['keyword'])) { + switch ($_GPC['type']) { + case 2 : + $where['@mobile@'] = $_GPC['keyword']; + break; + case 3 : + $where['@realname@'] = $_GPC['keyword']; + break; + case 5 : + $where['id'] = $_GPC['keyword']; + break; + default : + $where['@nickname@'] = $_GPC['keyword']; + } + } + } + + //时间 + if (!empty($_GPC['time_limit']) && $_GPC['timetype'] > 0) { + $starttime = strtotime($_GPC['time_limit']['start']); + $endtime = strtotime($_GPC['time_limit']['end']); + $where['createtime>'] = $starttime; + $where['createtime<'] = $endtime; + } + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + + if ($_GPC['mid']) { + $where['id'] = $_GPC['mid']; + } + //黑名单 + if ($_GPC['blackflag']) { + if ($_GPC['blackflag'] == 1) { + $where['blackflag'] = 1; + } else { + $where['blackflag'] = 0; + } + } + //用户身份 + if (!empty($_GPC['identity_id'])) $where['identity_id'] = $_GPC['identity_id']; + + //用户列表导出 + if($_GPC['export']){ + $this -> exportMmberList($where); + } + + $memberData = Util::getNumData("*", PDO_NAME . 'member', $where, 'id desc', $pindex, $psize, 1); + $list = $memberData[0]; + $pager = $memberData[1]; + + load()->model('mc'); + foreach ($list as $key => &$value) { + if (empty($value['openid']) && $value['uid']) { + $mfans = pdo_get('mc_mapping_fans', array('uid' => $value['uid'], 'uniacid' => $_W['uniacid']), array('openid')); + if ($mfans['openid']) { + $value['openid'] = $mfans['openid']; + pdo_update('wlmerchant_member', array('openid' => $mfans['openid']), array('id' => $value['id'])); + } + } + $result = mc_fansinfo($value['openid']); + $credit = pdo_get('mc_members', array('uid' => $value['uid']), array('credit1', 'credit2')); + $value['follow'] = $result['follow']; + $value['unfollowtime'] = $result['unfollowtime']; + $value['credit1'] = $credit['credit1']; + $value['credit2'] = $credit['credit2']; + $fans = pdo_get('mc_mapping_fans', array('openid' => $value['openid']), array('tag')); + $fans = base64_decode($fans['tag']); + $fans = unserialize($fans); + if(!empty($fans['headimgurl'])){ + $value['avatar'] = $fans['headimgurl']; + } + if(!empty($fans['nickname'])) { + $value['nickname'] = $fans['nickname']; + } + //pdo_update('wlmerchant_member', array('avatar' => $value['avatar'], 'nickname' => $value['nickname']), array('id' => $value['id'])); + if(!empty($value['encodename'])){ + $value['nickname'] = base64_decode($value['encodename']); + } + //推荐人 + if(empty($value['distributorid'])){ + $value['distributorid'] = pdo_getcolumn(PDO_NAME.'distributor',array('mid'=>$value['id']),'id'); + if( $value['distributorid'] > 0 ){ + pdo_update(PDO_NAME.'member',array('distributorid' => $value['distributorid']),array('id' => $value['id'])); + } + } + if ($value['distributorid']) { + $tjmid = pdo_getcolumn(PDO_NAME . 'distributor', array('id' => $value['distributorid']), 'leadid'); + $value['tjmid'] = $tjmid; + if ($tjmid > 0) { + $value['tjname'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $tjmid), 'nickname'); + } + } + + $identity_data = pdo_get(PDO_NAME . 'member_identity',['id' => $value['identity_id']]); // 获取身份 + $value['identity'] = $identity_data['name'] ?: '未知'; // 身份 + $value['is_show_identity'] = in_array($value['identity_id'],array(2,6)) ? true : false; // 是否显示达人赋予按钮 + + //统计订单和金额 + $dealnum1 = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_rush_order') . " WHERE mid = {$value['id']} AND uniacid = {$_W['uniacid']} AND status IN (1,2,3,4,6,8,9)"); + $dealnum2 = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . " WHERE mid = {$value['id']} AND uniacid = {$_W['uniacid']} AND status IN (1,2,3,4,6,8,9)"); + $dealnum = $dealnum2 + $dealnum1; + + $dealmoney1 = pdo_fetchcolumn('SELECT SUM(actualprice) FROM ' . tablename('wlmerchant_rush_order') . " WHERE mid = {$value['id']} AND uniacid = {$_W['uniacid']} AND status IN (1,2,3,4,6,8,9)"); + $dealmoney2 = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . " WHERE mid = {$value['id']} AND uniacid = {$_W['uniacid']} AND status IN (1,2,3,4,6,8,9)"); + $dealmoney = $dealmoney1 + $dealmoney2; + $value['dealnum'] = $dealnum; + $value['dealmoney'] = $dealmoney; + pdo_update('wlmerchant_member', array('dealnum' => $dealnum, 'dealmoney' => $dealmoney), array('id' => $value['id'])); + } + + $identityList = pdo_getall(PDO_NAME . 'member_identity',['status' => 1],['id','name']); + include wl_template('member/listIndex'); + } + //导出用户信息 + public function exportMmberList($where) { + global $_W; + $memberData = Util::getNumData("*", PDO_NAME . 'member', $where, 'id desc', 0, 0, 1); + $list = $memberData[0]; + load()->model('mc'); + foreach ($list as $key => &$value) { + if (empty($value['openid']) && $value['uid']) { + $mfans = pdo_get('mc_mapping_fans', array('uid' => $value['uid'], 'uniacid' => $_W['uniacid']), array('openid')); + if ($mfans['openid']) { + $value['openid'] = $mfans['openid']; + pdo_update('wlmerchant_member', array('openid' => $mfans['openid']), array('id' => $value['id'])); + } + } + $result = mc_fansinfo($value['openid']); + $credit = pdo_get('mc_members', array('uid' => $value['uid']), array('credit1', 'credit2')); + $value['follow'] = $result['follow']; + $value['unfollowtime'] = $result['unfollowtime']; + $value['credit1'] = $credit['credit1']; + $value['credit2'] = $credit['credit2']; + if($value['follow'] > 0){ + $value['followst'] = '已关注'; + }else if($value['unfollowtime'] > 0){ + $value['followst'] = '取消关注'; + }else{ + $value['followst'] = '未关注'; + } + if(!empty($value['openid']) && !empty($value['wechat_openid'])){ + $value['source'] = '双渠道'; + }else if(!empty($value['openid'])){ + $value['source'] = '公众号'; + }else if(!empty($value['openid'])){ + $value['source'] = '小程序'; + } + if (empty($value['avatar']) || empty($value['nickname'])) { + $fans = pdo_get('mc_mapping_fans', array('openid' => $value['openid']), array('tag')); + $fans = base64_decode($fans['tag']); + $fans = unserialize($fans); + $value['avatar'] = $fans['headimgurl']; + $value['nickname'] = $fans['nickname']; + pdo_update('wlmerchant_member', array('avatar' => $value['avatar'], 'nickname' => $value['nickname']), array('id' => $value['id'])); + } + if ($value['distributorid']>0) { + $tjmid = pdo_getcolumn(PDO_NAME . 'distributor', array('id' => $value['distributorid']), 'leadid'); + if ($tjmid > 0) { + $value['tjname'] = pdo_getcolumn(PDO_NAME . 'member', array('id' => $tjmid), 'nickname'); + }else{ + $value['tjname'] = "- 无 -"; + } + } + //统计订单和金额 + $dealnum1 = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_rush_order') . " WHERE mid = {$value['id']} AND uniacid = {$_W['uniacid']} AND status IN (1,2,3,4,6,8,9)"); + $dealnum2 = pdo_fetchcolumn('SELECT count(id) FROM ' . tablename('wlmerchant_order') . " WHERE mid = {$value['id']} AND uniacid = {$_W['uniacid']} AND status IN (1,2,3,4,6,8,9)"); + $dealnum = $dealnum2 + $dealnum1; + + $dealmoney1 = pdo_fetchcolumn('SELECT SUM(actualprice) FROM ' . tablename('wlmerchant_rush_order') . " WHERE mid = {$value['id']} AND uniacid = {$_W['uniacid']} AND status IN (1,2,3,4,6,8,9)"); + $dealmoney2 = pdo_fetchcolumn('SELECT SUM(price) FROM ' . tablename('wlmerchant_order') . " WHERE mid = {$value['id']} AND uniacid = {$_W['uniacid']} AND status IN (1,2,3,4,6,8,9)"); + $dealmoney = $dealmoney1 + $dealmoney2; + $value['dealnum'] = $dealnum; + $value['dealmoney'] = $dealmoney; + pdo_update('wlmerchant_member', array('dealnum' => $dealnum, 'dealmoney' => $dealmoney), array('id' => $value['id'])); + } + + /* 输出表头 */ + $filter = array( + 'id' => '用户MID',//U + 'nickname' => '用户昵称',//A + 'realname' => '真实姓名',//B + 'mobile' => '手机号',//E + 'source' => '渠道', + 'credit1' => '积分',//C + 'credit2' => '余额',//D + 'createtime' => '注册时间',//F + 'dealnum' => '商品订单量',//G + 'dealmoney' => '商品订单金额',//H + 'followst' => '关注状态', + 'card_number' => '银行卡账号', + 'bank_name' => '开户行', + 'alipay' => '支付宝账号', + 'tjname' => '推荐人' + ); + + $data = array(); + for ($i=0; $i < count($list) ; $i++) { + foreach ($filter as $key => $title) { + $data[$i][$key] = $list[$i]['id']; + if ($key == 'createtime') { + $data[$i][$key] = "\t".date('Y-m-d H:i:s', $list[$i][$key])."\t"; + }else { + $data[$i][$key] = $list[$i][$key]; + } + } + } + util_csv::export_csv_2($data, $filter, '用户表.csv'); + exit(); + } + //用户详细信息 + public function memberDetail() { + global $_W, $_GPC; + $id = intval($_GPC['id']); + + if ($_W['ispost']) { + $data = is_array($_GPC['data']) ? $_GPC['data'] : array(); + + if (!empty($data['mobile'])) { + $m = pdo_fetch('select id from ' . tablename('wlmerchant_member') . ' where mobile=:mobile and uniacid=:uniaicd limit 1 ', array(':mobile' => $data['mobile'], ':uniaicd' => $_W['uniacid'])); + if (!empty($m) && $m['id'] != $id) { + show_json(0, '此手机号已绑定其他用户!(mid:' . $m['id'] . ')'); + } + } + + $data['password'] = trim($data['password']); + if (!empty($data['password'])) { + $salt = pdo_getcolumn(PDO_NAME . 'member', array('id' => $id, 'uniacid' => $_W['uniacid']), 'salt'); + if (empty($salt)) { + $salt = random(8); + } + $data['password'] = md5($data['password'] . $salt); + $data['salt'] = $salt; + } else { + unset($data['password']); + unset($data['salt']); + } + + pdo_update('wlmerchant_member', $data, array('id' => $id, 'uniacid' => $_W['uniacid'])); + show_json(1); + } + $member = Member::wl_member_get($id); + $result = mc_fansinfo($member['openid']); + if (!empty($result)) { + $member['follow'] = $result['follow']; + $member['unfollowtime'] = $result['unfollowtime']; + } + if($member['distributorid']>0){ + $member['leadid'] = pdo_getcolumn(PDO_NAME.'distributor',array('id'=>$member['distributorid']),'leadid'); + $member['leadname'] = pdo_getcolumn(PDO_NAME.'member',array('id'=>$member['leadid']),'nickname'); + } + + include wl_template('member/listDetail'); + } + //拉黑用户 + public function toblack() { + global $_W, $_GPC; + $id = intval($_GPC['id']); + $flag = intval($_GPC['flag']); + pdo_update('wlmerchant_member', array('blackflag' => $flag), array('id' => $id, 'uniacid' => $_W['uniacid'])); + //同时删除所有帖子 + if ($flag) { + pdo_update('wlmerchant_pocket_informations', array('status' => 3), array('mid' => $id, 'uniacid' => $_W['uniacid'])); + } + show_json(1, array('url' => referer())); + } + //删除用户 + public function memberDelete() { + global $_W, $_GPC; + $id = intval($_GPC['id']); + pdo_delete('wlmerchant_distributor', array('mid' => $id, 'uniacid' => $_W['uniacid'])); + pdo_delete('wlmerchant_member', array('id' => $id, 'uniacid' => $_W['uniacid'])); + //同步删除相关招聘信息 + pdo_delete(PDO_NAME."recruit_recruit",['recruitment_type'=>1,'release_mid'=>$id]); + + show_json(1, array('url' => referer())); + } + //用户账户 + public function memberRecharge() { + global $_W, $_GPC; + $type = trim($_GPC['type']); + $id = intval($_GPC['id']); + $profile = Member::wl_member_get($id); + + if ($_W['ispost']) { + $typestr = $type == 'credit1' ? '积分' : '余额'; + $num = floatval($_GPC['num']); + $remark = trim($_GPC['remark']) ? trim($_GPC['remark']) : '后台手动操作'; + + if ($num <= 0) { + show_json(0, array('message' => '请填写大于0的数字!')); + } + + $changetype = intval($_GPC['changetype']); + if ($changetype == 0) { + $changenum = $num; + } else { + $changenum = 0 - $num; + } + + $data = ($type == 'credit1') ? Member::credit_update_credit1($id, $changenum, $remark) : Member::credit_update_credit2($id, $changenum, $remark); + if (is_error($data)) { + show_json(0, array('message' => $data['message'])); + } + + show_json(1, array('url' => referer())); + } + + include wl_template('member/listRecharge'); + } + //合并用户信息 + public function membermerge() { + global $_W, $_GPC; + if ($_W['ispost']) { + $cache_data = Cache::getCache('member', 'mergedata'); + if ($cache_data['total'] == $cache_data['success']) { + Cache::deleteCache('member', 'mergedata'); + wl_json(1); + } + + $datas = ['mobile', 'unionid']; + foreach ($datas as $data) { + if (!empty($cache_data['data'][$data])) { + Member::wl_member_merge($cache_data['data'][$data][0], $data); + unset($cache_data['data'][$data][0]); + $cache_data['data'][$data] = array_values($cache_data['data'][$data]); + $cache_data['success'] = $cache_data['success'] + 1; + break; + } + } + + Cache::setCache('member', 'mergedata', $cache_data); + wl_json(0, '', array('total' => $cache_data['total'], 'success' => $cache_data['success'])); + } + $mobiles = $this->membermerge_sql('mobile'); + $nomobile = pdo_getcolumn('wlmerchant_member', array('uniacid' => $_W['uniacid'], 'mobile' => ''), 'COUNT(id)'); + $unionids = $this->membermerge_sql('unionid'); + $nounionid = pdo_getcolumn('wlmerchant_member', array('uniacid' => $_W['uniacid'], 'unionid' => ''), 'COUNT(id)'); + + $cache_data = ['total' => count($mobiles) + count($unionids), 'success' => 0, 'data' => ['mobile' => $mobiles, 'unionid' => $unionids]]; + Cache::setCache('member', 'mergedata', $cache_data); + + include wl_template('member/membermerge'); + } + //执行用户合并操作 + private function membermerge_sql($field) { + global $_W; +// $members = pdo_fetchall("select `id`,`{$field}` from " . tablename('wlmerchant_member') . " WHERE `uniacid` = {$_W['uniacid']} AND `{$field}` in ( select `{$field}` from " . tablename('wlmerchant_member') . " WHERE `uniacid` = {$_W['uniacid']} AND `{$field}` <> '' group by `{$field}` having count(`mobile`) > 1);"); +// if (empty($members)) { +// return []; +// } + $merge_data = []; +// foreach ($members as $member) { +// if (!in_array($member[$field], $merge_data)) { +// array_push($merge_data, $member[$field]); +// } +// } + $members = pdo_fetchall("select `{$field}`,count(*) as count from".tablename('wlmerchant_member')." WHERE uniacid = {$_W['uniacid']} group by `{$field}` having count>1 "); + foreach ($members as $mem){ + if(strlen($mem[$field])>1){ + $merge_data[] = $mem[$field]; + } + } + return $merge_data; + } + //同步用户信息 + public function membersync() { + global $_W, $_GPC; + if ($_W['ispost']) { + $pindex = max(1, intval($_GPC['page'])); + $sync_fans = pdo_getslice('wlmerchant_member', array('uniacid' => $_W['uniacid']), array($pindex, 50), $total, array('id', 'openid')); + $total = ceil($total / 50); + foreach ($sync_fans as $sync_fan) { + if (!empty($sync_fan['openid'])) { + $userinfo = Member::wl_fans_info($sync_fan['openid']); + Member::wl_member_update($userinfo, $sync_fan['id']); + } + } + wl_json(0, '', array('pindex' => $pindex, 'total' => $total)); + } + include wl_template('member/membersync'); + } + //导入系统粉丝 + public function memberImport() { + global $_W, $_GPC; + if ($_W['ispost']) { + $pindex = max(1, intval($_GPC['page'])); + $sync_fans = pdo_getslice('mc_mapping_fans', array('uniacid' => $_W['uniacid']), array($pindex, 50), $total, array('openid')); + $total = ceil($total / 50); + foreach ($sync_fans as $sync_fan) { + if (!empty($sync_fan['openid'])) { + $userinfo = Member::wl_fans_info($sync_fan['openid']); + Member::wl_member_create($userinfo); + } + } + wl_json(0, '', array('pindex' => $pindex, 'total' => $total)); + } + include wl_template('member/memberImport'); + } + //选择用户 + public function selectMember() { + global $_W, $_GPC; + $where = array(); + $keyword = trim($_GPC['keyword']); + if ($keyword != '') + $where['nickname^openid^uid'] = $keyword; + $dsData = Util::getNumData('nickname,avatar,openid', PDO_NAME . 'member', $where, 'id desc', 0, 0, 0); + $ds = $dsData[0]; + include wl_template('member/selectMember'); + } + + + //用户设置 + public function userset() { + global $_W, $_GPC; + $settings = Setting::wlsetting_read('userset'); + $settings['plugin'] = unserialize($settings['plugin']); + if (checksubmit('submit')) { + $base = Util::trimWithArray($_GPC['userset']); + $base['plugin'] = serialize($_GPC['plugin']); + Setting::wlsetting_save($base, 'userset'); + show_json(1); + } + + include wl_template('member/userset'); + } + + + + //转赠列表 + public function transferlist(){ + global $_W, $_GPC; + #1、获取基本参数 + $pindex = max(1, intval($_GPC['page'])); + $psize = 20; + $start = $pindex * $psize - $psize; + $keyword = $_GPC['keyword'];//关键字 + $keywordtype = $_GPC['keywordtype'];//关键字类型 + $timeLimit = $_GPC['time_limit'];//时间段 + $where = " a.uniacid = {$_W['uniacid']} "; + + if ($keyword) { + if ($keywordtype == 1) { + $where .= " AND b.id LIKE '%{$keyword}%'"; + } else if ($keywordtype == 2) { + $where .= " AND b.nickname LIKE '%{$keyword}%'"; + } else if ($keywordtype == 3) { + $where .= " AND b.mobile LIKE '%{$keyword}%'"; + } else if ($keywordtype == 4) { + $where .= " AND a.allmoney > '{$keyword}'"; + } else if ($keywordtype == 5) { + $where .= " AND a.allmoney < '{$keyword}'"; + } else if ($keywordtype == 6) { + $where .= " AND a.id LIKE '%{$keyword}%'"; + } else if ($keywordtype == 7) { + $where .= " AND a.title LIKE '%{$keyword}%'"; + } + } + + if ($timeLimit) { + $starttime = strtotime($timeLimit['start']); + $endtime = strtotime($timeLimit['end']); + $where .= " AND a.createtime >= {$starttime} "; + $where .= " AND a.createtime <= {$endtime} "; + } + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + $limit = " LIMIT {$start},{$psize}"; + $sql = "SELECT a.id,a.mid,a.allnum,a.title,a.surplus,a.allmoney,a.money,a.createtime,b.nickname,b.avatar FROM " + . tablename("wlmerchant_transfer_list") + . " a LEFT JOIN " . tablename(PDO_NAME . "member") . " b ON a.mid = b.id WHERE {$where} ORDER BY a.createtime DESC"; + + $total = pdo_fetchcolumn('SELECT count(a.id) FROM ' . tablename('wlmerchant_transfer_list') . " a LEFT JOIN " . tablename(PDO_NAME . "member") . " b ON a.mid = b.id WHERE {$where}"); + $pager = wl_pagination($total, $pindex, $psize); + $lists = pdo_fetchall($sql . $limit); + + + include wl_template('member/transferlist'); + } + //转赠记录 + public function transferrecord(){ + global $_W, $_GPC; + #1、获取基本参数 + $pindex = max(1, intval($_GPC['page'])); + $psize = 20; + $start = $pindex * $psize - $psize; + $keyword = $_GPC['keyword'];//关键字 + $keywordtype = $_GPC['keywordtype'];//关键字类型 + $timeLimit = $_GPC['time_limit'];//时间段 + $where = " a.uniacid = {$_W['uniacid']} "; + + if ($keyword) { + if ($keywordtype == 1) { + $where .= " AND b.id LIKE '%{$keyword}%'"; + } else if ($keywordtype == 2) { + $where .= " AND b.nickname LIKE '%{$keyword}%'"; + } else if ($keywordtype == 3) { + $where .= " AND b.mobile LIKE '%{$keyword}%'"; + } else if ($keywordtype == 4) { + $where .= " AND d.id LIKE '%{$keyword}%'"; + } else if ($keywordtype == 5) { + $where .= " AND d.title LIKE '%{$keyword}%'"; + } + } + + if ($timeLimit) { + $starttime = strtotime($timeLimit['start']); + $endtime = strtotime($timeLimit['end']); + $where .= " AND a.createtime >= {$starttime} "; + $where .= " AND a.createtime <= {$endtime} "; + } + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + $limit = " LIMIT {$start},{$psize}"; + $sql = "SELECT a.tid,a.mid,a.money,d.title,a.realname,a.mobile,a.createtime,b.nickname,b.avatar FROM " + . tablename("wlmerchant_transfer_record") + . " as a LEFT JOIN " . tablename(PDO_NAME . "member") . " as b ON a.mid = b.id " + . " LEFT JOIN " . tablename(PDO_NAME . "transfer_list") . " as d ON a.tid = d.id WHERE {$where} ORDER BY a.createtime DESC"; + + $total = pdo_fetchcolumn('SELECT count(a.id) FROM ' . tablename('wlmerchant_transfer_record') . " as a LEFT JOIN " . tablename(PDO_NAME . "member") . " as b ON a.mid = b.id LEFT JOIN " . tablename(PDO_NAME . "transfer_list") . " as d ON a.tid = d.id WHERE {$where}"); + + + $pager = wl_pagination($total, $pindex, $psize); + $lists = pdo_fetchall($sql . $limit); + + + include wl_template('member/transferrecord'); + } + + + //导出可转赠记录 + + public function exportTransfer(){ + global $_W, $_GPC; + $mid = $_GPC['mid']; + $nickname = pdo_getcolumn(PDO_NAME.'member',array('id'=>$mid),'nickname'); + $transfer = []; + //获取卡券列表 + $coupons = pdo_getall('wlmerchant_member_coupons',array('status' => 1,'uniacid' => $_W['uniacid'],'mid' => $mid),array('transferflag','id','parentid','title','sub_title'),'','ID DESC'); + if(!empty($coupons)){ + foreach ($coupons as $cou){ + $parentcoupons = pdo_get('wlmerchant_couponlist',array('id' => $cou['parentid']),array('transferstatus','transfermore')); + if($parentcoupons['transferstatus'] > 0){ + if(empty($cou['transferflag']) || $parentcoupons['transfermore'] > 0) { + $obj = [ + 'id' => $cou['id'], + 'type' => 1, + 'title' => $cou['title'], + 'desc' => $cou['sub_title'], + 'mobile' => '' + ]; + $transfer[] = $obj; + } + } + } + } + //获取红包列表 + $redpacks = pdo_getall('wlmerchant_redpack_records',array('status' => 0,'uniacid' => $_W['uniacid'],'mid' => $mid),array('transferflag','id','packid'),'','ID DESC'); + if(!empty($redpacks)){ + foreach ($redpacks as $red){ + $parent = pdo_get('wlmerchant_redpacks',array('id' => $red['packid']),array('title','transferstatus','transfermore','full_money','cut_money')); + if($parent['transferstatus'] > 0){ + if(empty($red['transferflag']) || $parent['transfermore'] > 0) { + if($parent['full_money'] > 0){ + $desc = '满'.$parent['full_money'].'元减'.$parent['cut_money'].'元'; + }else{ + $desc = '立减'.$parent['cut_money'].'元'; + } + $obj = [ + 'id' => $red['id'], + 'type' => 2, + 'title' => $parent['title'], + 'desc' => $desc, + 'mobile' => '' + ]; + $transfer[] = $obj; + } + } + } + } + if(empty($transfer)){ + wl_message('用户无可转赠卡券与红包'); + } + //导出 + /* 输出表头 */ + $filter = array( + 'id' => '对象id',//U + 'type' => '对象类型(1卡券2红包)',//A + 'title' => '名称',//B + 'desc' => '描述',//E + 'mobile' => '被转赠手机号' + ); + util_csv::export_csv_2($transfer, $filter, $nickname.'可转增列表.csv'); + exit(); + } + + + public function transferSend(){ + global $_W, $_GPC; + #1、将获取基本信息 + $name = $_GPC['name'];//文件储存路径 + $fullName = PATH_ATTACHMENT . $name;//文件在本地服务器暂存地址 + #2、读取excel中的内容 + $info = util_csv::read_csv_lines($fullName, 999, 0); + unlink($fullName);//获取文件信息后将.cvs文件删除 + #3、对读取到的信息进行处理 + foreach ($info as $k => &$v) { + //3-1 判断是否存在数据 不存在是空行,不进行任何操作 + if (!is_array($v)) { + unset($info[$k]); + continue; + } + //3-2 编码转换 由gbk转为urf-8 + $separator = '*separator*';//分割符 写成长字符串 防止出错 + $encodres = mb_detect_encoding(implode($separator, $v), array("ASCII","GB2312","GBK","UTF-8")); + if($encodres != 'UTF-8'){ + $v = explode($separator, iconv('gbk', 'utf-8', implode($separator, $v))); + } + //处理转赠送 + $inRes = 0; + if (empty($v[4])){ + $v['send_result'] = '无手机号,不转赠'; + continue; + } + $getMember = pdo_get('wlmerchant_member',array('mobile' => $v[4],'uniacid' => $_W['uniacid']),array('id','nickname')); + if(empty($getMember)){ + $v['send_result'] = '手机号不存在,无法转赠'; + continue; + } + if($v[1] == 1){ + $coupon = pdo_get('wlmerchant_member_coupons',array('id' => $v[0]),array('mid','parentid','status','title','orderno','transferflag')); + $omid = $coupon['mid']; + if($getMember['id'] == $coupon['mid']){ + $v['send_result'] = '不能转赠给自己'; + continue; + } + if($coupon['status'] != 1){ + $v['send_result'] = '卡券状态错误,无法转赠'; + continue; + } + if(empty($coupon['transferflag'])){ + pdo_update('wlmerchant_order',array('status' => 2),array('orderno' => $coupon['orderno'],'status' => 1)); //修改订单状态 + } + $res1 = pdo_update('wlmerchant_member_coupons',array('mid' => $getMember['id'],'transferflag' => 1),array('id' => $v[0])); //修改卡券所属用户 + $res3 = pdo_update('wlmerchant_smallorder',array('mid' => $getMember['id']),array('orderno' => $coupon['orderno'])); //修改子订单状态 + if(empty($res1) || empty($res3)){ + $v['send_result'] = '转赠失败,请联系管理员'; + continue; + } + }else{ + $redapck = pdo_get('wlmerchant_redpack_records',array('id' => $v[0]),array('mid','packid','status','transferflag')); + $omid = $redapck['mid']; + if($getMember['id'] == $redapck['mid']){ + $v['send_result'] = '不能转赠给自己'; + continue; + } + if($redapck['status'] != 0){ + $v['send_result'] = '红包状态错误,无法转赠'; + continue; + } + $res1 = pdo_update('wlmerchant_redpack_records',array('mid' => $getMember['id'],'transferflag' => 1),array('id' => $v[0])); //修改红包所属用户 + if(empty($res1)){ + $v['send_result'] = '转赠失败,请联系管理员'; + continue; + } + } + //生成转赠记录 + $data = [ + 'uniacid' => $_W['uniacid'], + 'type' => $v[1], + 'objid' => $v[0], + 'omid' => $omid, + 'nmid' => $getMember['id'], + 'status' => 1, + 'createtime' => time(), + 'gettime' => time(), + 'transfermode' => 3, + 'mobile' => $v[4] + ]; + $inRes = pdo_insert(PDO_NAME . 'transferRecord', $data); + if($inRes > 0){ + $v['send_result'] = '转赠成功'; + }else{ + $v['send_result'] = '转赠失败,请联系管理员'; + } + } + + #4、定义结果表格的标题 + $filter = array( + 0 => '对象id', + 1 => '对象类型', + 2 => '名称', + 3 => '描述', + 4 => '转赠人手机号', + 'send_result' => '转赠结果', + ); + #5、返回批量发货的结果信息表 + util_csv::save_csv($info, $filter, $_W['uniacid'].'/'.date('Y-m-d',time()).'/'.'批量转赠结果信息'.date('Y-m-d',time()).'.csv'); + util_csv::export_csv_2($info, $filter, '批量转赠结果信息'.date('Y-m-d',time()).'.csv'); + } + + /* + * 变更为达人 + */ + public function changeUserIdentity(){ + global $_W, $_GPC; + + $id = intval($_GPC['id']); + if (empty($id) || !is_numeric($id)) show_json(0, '参数有误'); + $member_res = pdo_get(PDO_NAME . 'member',array( + 'id' => $id, + 'identity_id' => array(2,6) + ),'identity_id'); + if (!$member_res) show_json(0,'数据有误,请重试'); + $identity_id = 7; + $result = pdo_update(PDO_NAME . 'member', array('identity_id' => $identity_id), array('id' => $id)); + if ($result) { + show_json(1,[ + 'message' => '成功', + 'url' => referer() + ]); + } + show_json(0,'失败'); + } + + // 个人权限 + public function memberRights() + { + global $_W, $_GPC; + $id = intval($_GPC['id']); + $profile = Member::wl_member_get($id); + $rights = unserialize($profile['rights']); + if ($_W['ispost']) { + + $rights = $_GPC['rights']; + + $update = pdo_update(PDO_NAME . 'member',['rights' => serialize($rights)],['id' => $id]); + if (!$update) show_json(0, array('message' => '提交失败')); + + show_json(1, array('url' => referer())); + } + + include wl_template('member/rightsIndex'); + } + + + +} diff --git a/addons/weliam_smartcity/sys/controller/order/orderAfterSales.ctrl.php b/addons/weliam_smartcity/sys/controller/order/orderAfterSales.ctrl.php new file mode 100644 index 0000000..3d69741 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/order/orderAfterSales.ctrl.php @@ -0,0 +1,247 @@ +'] = $starttime; + $where['createtime<'] = $endtime; + }else{ + $where['dotime>'] = $starttime; + $where['dotime<'] = $endtime; + } + } + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + + + $afterData = Util::getNumData("*", PDO_NAME . 'aftersale', $where, 'createtime desc', $pindex, $psize, 1); + $afterlist = $afterData[0]; + $pager = $afterData[1]; + foreach ($afterlist as &$after){ + $member = pdo_get('wlmerchant_member',array('id' => $after['mid']),array('mobile','nickname','realname')); + $store = ''; + if($after['plugin'] == 'rush'){ + $order = pdo_get('wlmerchant_rush_order',array('id' => $after['orderid']),array('sid','blendcredit','activityid','price','expressid','paytype','actualprice','num','optionid')); + $goods = pdo_get('wlmerchant_rush_activity',array('id' => $order['activityid']),array('name','thumb')); +// if($order['expressid']){ +// $expressprice = pdo_getcolumn(PDO_NAME.'express',array('id'=>$order['expressid']),'expressprice'); +// $rushprice = $order['price'] - $expressprice; +// }else{ +// $rushprice = $order['price']; +// } + $after['goodsprice'] = sprintf("%.2f",$order['price']/$order['num']); + if($order['optionid']){ + $after['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$order['optionid']),'title'); + } + $after['orderprice'] = $order['actualprice']; + $after['plugintext'] = '抢购'; + $after['plugincss'] = 'success'; + $after['goodsid'] = $order['activityid']; + $after['ordertype'] = 'a'; + $after['detailurl'] = web_url('order/wlOrder/orderdetail',array('orderid'=>$after['orderid'],'type'=>1,'is_jurisdiction'=>1)); + }else if($after['plugin'] == 'groupon'){ + $order = pdo_get('wlmerchant_order',array('id' => $after['orderid']),array('sid','blendcredit','fkid','price','expressid','paytype','goodsprice','num','specid')); + $goods = pdo_get('wlmerchant_groupon_activity',array('id' => $order['fkid']),array('name','thumb')); + $after['goodsprice'] = sprintf("%.2f",$order['goodsprice']/$order['num']); + if($order['specid']){ + $after['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$order['specid']),'title'); + } + $after['orderprice'] = $order['price']; + $after['plugintext'] = '团购'; + $after['plugincss'] = 'info'; + $after['goodsid'] = $order['fkid']; + $after['ordertype'] = 'b'; + $after['detailurl'] = web_url('order/wlOrder/orderdetail',array('orderid'=>$after['orderid'],'type'=>10,'is_jurisdiction'=>1)); + }else if($after['plugin'] == 'activity'){ + $order = pdo_get('wlmerchant_order',array('id' => $after['orderid']),array('sid','blendcredit','fkid','price','expressid','paytype','goodsprice','num','specid')); + $goods = pdo_get('wlmerchant_activitylist',array('id' => $order['fkid']),array('title','thumb')); + $goods['name'] = $goods['title']; + $after['goodsprice'] = sprintf("%.2f",$order['goodsprice']/$order['num']); + if($order['specid']){ + $after['optiontitle'] = pdo_getcolumn(PDO_NAME.'activity_spec',array('id'=>$order['specid']),'name'); + } + $after['orderprice'] = $order['price']; + $after['plugintext'] = '活动'; + $after['plugincss'] = 'info'; + $after['goodsid'] = $order['fkid']; + $after['ordertype'] = 'b'; + $after['detailurl'] = web_url('order/wlOrder/orderdetail',array('orderid'=>$after['orderid'],'type'=>9,'is_jurisdiction'=>1)); + }else if($after['plugin'] == 'wlfightgroup'){ + $order = pdo_get('wlmerchant_order',array('id' => $after['orderid']),array('sid','blendcredit','fkid','price','expressid','paytype','goodsprice','num','specid')); + $goods = pdo_get('wlmerchant_fightgroup_goods',array('id' => $order['fkid']),array('name','logo')); + $after['goodsprice'] = sprintf("%.2f",$order['goodsprice']/$order['num']); + if($order['specid']){ + $after['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$order['specid']),'title'); + } + $after['orderprice'] = $order['price']; + $after['plugintext'] = '拼团'; + $after['plugincss'] = 'warning'; + $after['goodsid'] = $order['fkid']; + $after['ordertype'] = 'b'; + $after['detailurl'] = web_url('order/wlOrder/orderdetail',array('orderid'=>$after['orderid'],'type'=>2,'is_jurisdiction'=>1)); + }else if($after['plugin'] == 'coupon'){ + $order = pdo_get('wlmerchant_order',array('id' => $after['orderid']),array('sid','blendcredit','fkid','price','expressid','paytype','goodsprice','num','specid')); + $goods = pdo_get('wlmerchant_couponlist',array('id' => $order['fkid']),array('title','logo')); + $after['goodsprice'] = sprintf("%.2f",$order['goodsprice']/$order['num']); + $after['orderprice'] = $order['price']; + $after['plugintext'] = '卡券'; + $after['plugincss'] = 'danger'; + $after['goodsid'] = $order['fkid']; + $after['ordertype'] = 'b'; + $after['detailurl'] = web_url('order/wlOrder/orderdetail',array('orderid'=>$after['orderid'],'type'=>3,'is_jurisdiction'=>1)); + }else if($after['plugin'] == 'bargain'){ + $order = pdo_get('wlmerchant_order',array('id' => $after['orderid']),array('sid','blendcredit','fkid','price','expressid','paytype','goodsprice','num','specid')); + $goods = pdo_get('wlmerchant_bargain_activity',array('id' => $order['fkid']),array('name','thumb')); + $after['goodsprice'] = sprintf("%.2f",$order['goodsprice']/$order['num']); + $after['orderprice'] = $order['price']; + $after['plugintext'] = '砍价'; + $after['plugincss'] = 'primary'; + $after['goodsid'] = $order['fkid']; + $after['ordertype'] = 'b'; + $after['detailurl'] = web_url('order/wlOrder/orderdetail',array('orderid'=>$after['orderid'],'type'=>12,'is_jurisdiction'=>1)); + }else if($after['plugin'] == 'citydelivery'){ + $order = pdo_get('wlmerchant_order',array('id' => $after['orderid']),array('id','blendcredit','sid','fkid','price','expressid','paytype','goodsprice','num','specid')); + $order['num'] = 1; + $store = pdo_get('wlmerchant_merchantdata',array('id' => $order['sid']),array('storename','logo','id')); + $goods['name'] = '['.$store['storename'].']配送商品'; + $goods['thumb'] = tomedia($store['logo']); + $after['goodsprice'] = sprintf("%.2f",$order['goodsprice']); + $after['orderprice'] = $order['price']; + $after['plugintext'] = '同城配送'; + $after['plugincss'] = 'primary'; + $after['ordertype'] = 'b'; + $after['detailurl'] = web_url('order/wlOrder/orderdetail',array('orderid'=>$after['orderid'],'type'=>14,'is_jurisdiction'=>1)); + }else if($after['plugin'] == 'housekeep'){ + $order = pdo_get('wlmerchant_order',array('id' => $after['orderid']),array('id','blendcredit','sid','fkid','price','expressid','paytype','goodsprice','num','specid')); + $order['num'] = 1; + if($order['specid'] == 1){ + $store = pdo_get('wlmerchant_merchantdata',array('id' => $order['sid']),array('storename','logo','id')); + }else{ + $store = pdo_get('wlmerchant_housekeep_artificer',array('id' => $order['sid']),array('name','mid','id')); + $store['storename'] = $store['name']; + $store['logo'] = pdo_getcolumn(PDO_NAME.'member',array('uniacid'=>$store['mid']),'avatar'); + } + $service = pdo_get('wlmerchant_housekeep_service',array('id' => $order['fkid']),array('title','thumb')); + $goods['name'] = $service['title']; + $goods['thumb'] = tomedia($service['thumb']); + $after['goodsprice'] = sprintf("%.2f",$order['price']); + $after['orderprice'] = $order['price']; + $after['plugintext'] = '家政服务'; + $after['plugincss'] = 'primary'; + $after['ordertype'] = 'b'; + //$after['detailurl'] = web_url('order/wlOrder/orderdetail',array('orderid'=>$after['orderid'],'type'=>14,'is_jurisdiction'=>1)); + } + if(empty($store)){ + $store = pdo_get('wlmerchant_merchantdata',array('id' => $after['sid']),array('storename')); + } + $after['paytype'] = $order['paytype']; + $after['nickname'] = $member['nickname']; + $after['mobile'] = $member['mobile']; + $after['realname'] = $member['realname']; + $after['goodsname'] = $goods['name']?$goods['name']:$goods['title']; + $after['goodsimg'] = $goods['thumb']?$goods['thumb']:$goods['logo']; + $after['storename'] = $store['storename']; + $after['num'] = $order['num']; + //混合支付 + if($order['blendcredit'] > 0){ + $after['paytype'] = 7; + } + + } + + include wl_template('order/afterlist'); + } + /** + * Comment: 售后申请驳回 + * Author: wlf + */ + public function rejectafter(){ + global $_W,$_GPC; + $id = $_GPC['id']; + if($_W['ispost']) { + $after = pdo_get('wlmerchant_aftersale' , ['id' => $id] , ['checkcodes','mid']); + $checkcodes = unserialize($after['checkcodes']); + foreach ($checkcodes as $code){ + pdo_update('wlmerchant_smallorder',array('status' => 1),array('checkcode' => $code)); + } + $data = array( + 'reply' => $_GPC['reply'], + 'status' => 3, + 'dotime' => time() + ); + $journal = array( + 'time' => time(), + 'title' => '申请被驳回', + 'detail' => '驳回原因:'.$data['reply'], + ); + $journals = Order::addjournal($journal,$id); + $data['journal'] = $journals; + $res = pdo_update('wlmerchant_aftersale',$data,array('id' => $id)); + if($res){ + //发送模板消息 通知用户 + $modelData = [ + 'first' => '' , + 'type' => '售后结果通知' ,//业务类型 + 'content' => $journal['detail'] ,//业务内容 + 'status' => '驳回' ,//处理结果 + 'time' => date("Y-m-d H:i:s" , $journal['time']) ,//操作时间$store['createtime'] + 'remark' => '' + ]; + TempModel::sendInit('service' , $after['mid'] , $modelData , 1); + + show_json(1,'驳回成功'); + }else { + show_json(0,'驳回失败,请重试'); + } + } + + + include wl_template('order/rejectafter'); + } + + +} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/controller/order/orderFreightTemplate.ctrl.php b/addons/weliam_smartcity/sys/controller/order/orderFreightTemplate.ctrl.php new file mode 100644 index 0000000..119dbe1 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/order/orderFreightTemplate.ctrl.php @@ -0,0 +1,102 @@ + $_W['uniacid']), array('id', 'agentname')); + } + if($id){ + $info = pdo_get('wlmerchant_express_template',array('id' => $id)); + $info['expressarray'] = unserialize($info['expressarray']); + } + if (checksubmit('submit')){ + + $data['name'] = htmlspecialchars($_GPC['expressname']); + $data['defaultnum'] = intval($_GPC['defaultnum']); + $data['defaultmoney'] = sprintf('%.2f',$_GPC['defaultmoney']); + $data['defaultnumex'] = intval($_GPC['defaultnumex']); + $data['defaultmoneyex'] = sprintf('%.2f',$_GPC['defaultmoneyex']); + $data['freenumber'] = intval($_GPC['freenumber']); + + + if(!empty($_GPC['express']['area']) && is_array($_GPC['express']['area'])){ + foreach($_GPC['express']['area'] as $k=>$v){ + $expressarray[] = array( + 'area'=>$v, + 'num'=> intval($_GPC['express']['num'][$k]), + 'money'=>sprintf('%.2f',$_GPC['express']['money'][$k]), + 'numex'=>intval($_GPC['express']['numex'][$k]), + 'moneyex'=>sprintf('%.2f',$_GPC['express']['moneyex'][$k]), + 'freenumber'=>intval($_GPC['express']['freenumber'][$k]), + ); + } + } + + $data['expressarray'] = serialize($expressarray); + $data['createtime'] = time(); + + if($_GPC['aid']){ + $data['aid'] = $_GPC['aid']; + }else{ + $data['aid'] = $_W['aid']; + } + $data['sid'] = $_W['storeid']; + if($id){ + $res = Store::updateExpress($data,$id); + if ($res) { + wl_message('更新运费模板成功', web_url('order/orderFreightTemplate/freightlist'), 'success'); + } else { + wl_message('更新运费模板失败', referer(),'error'); + } + }else { + $res = Store::saveExpress($data); + if ($res) { + wl_message('创建运费模板成功', web_url('order/orderFreightTemplate/freightlist'), 'success'); + } else { + wl_message('创建运费模板失败', referer(), 'error'); + } + } + } + include wl_template('order/creatfreight'); + } + //删除运费模板 + public function deleteExpress(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $res = Store::deteleExpress($id); + if($res){ + die(json_encode(array('errno'=>0,'message'=>$res,'id'=>$id))); + }else { + die(json_encode(array('errno'=>2,'message'=>$res,'id'=>$id))); + } + } + +} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/controller/order/orderPayOnline.ctrl.php b/addons/weliam_smartcity/sys/controller/order/orderPayOnline.ctrl.php new file mode 100644 index 0000000..7908135 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/order/orderPayOnline.ctrl.php @@ -0,0 +1,188 @@ + $_W['uniacid'], 'aid' => $_W['aid']) : array('uniacid' => $_W['uniacid']); + $stores = pdo_getall('wlmerchant_merchantdata', $store_where, array('id', 'storename')); + + $where = array(); + $where['uniacid'] = $_W['uniacid']; + $where['plugin'] = 'halfcard'; + $where['status>'] = 1; + $where['status!='] = 5; + if(is_agent()){ + $where['aid'] = $_W['aid']; + } + if(is_store()){ + $where['sid'] = $_W['storeid']; + }else{ + $sid = intval($_GPC['sid']); + if($sid){ + $where['sid'] = $sid; + } + } + if($_GPC['orderid'] > 0){ + $where['id'] = $_GPC['orderid']; + } + if($_GPC['paytype']){ + $where['paytype'] = $_GPC['paytype']; + } + + if($_GPC['keyword']){ + $keyword = $_GPC['keyword']; + if($_GPC['keywordtype'] == 1){ + $params[':name'] = "%{$keyword}%"; + $members = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_member')." WHERE uniacid = {$_W['uniacid']} AND nickname LIKE :name",$params); + if($members){ + $mids = "("; + foreach ($members as $key => $v) { + if($key == 0){ + $mids.= $v['id']; + }else{ + $mids.= ",".$v['id']; + } + } + $mids.= ")"; + $where['mid#'] = $mids; + } + }else if($_GPC['keywordtype'] == 2){ + $params[':name'] = "%{$keyword}%"; + $members = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_member')." WHERE uniacid = {$_W['uniacid']} AND mobile LIKE :name",$params); + if($members){ + $mids = "("; + foreach ($members as $key => $v) { + if($key == 0){ + $mids.= $v['id']; + }else{ + $mids.= ",".$v['id']; + } + } + $mids.= ")"; + $where['mid#'] = $mids; + } + } + } + + if($_GPC['time_limit']){ + $time_limit = $_GPC['time_limit']; + $starttime = strtotime($_GPC['time_limit']['start']); + $endtime = strtotime($_GPC['time_limit']['end']) ; + $where['paytime>'] = $starttime; + $where['paytime<'] = $endtime+86400; + } + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + + //导出 + if($_GPC['export']){ + $this -> exportpayonline($where); + } + + $payonlinelist = Util::getNumData('*','wlmerchant_order',$where,'paytime DESC',$pindex,$psize,1); + $pager = $payonlinelist[1]; + $list = $payonlinelist[0]; + foreach ($list as $key => &$li) { + $member = pdo_get('wlmerchant_member',array('id' => $li['mid']),array('avatar','nickname')); + $li['avatar'] = tomedia($member['avatar']); + $li['nickname'] = $member['nickname']; + $store = pdo_get(PDO_NAME.'merchantdata',array('uniacid'=>$_W['uniacid'],'id'=>$li['sid']),array('logo','storename')); + $li['logo'] = tomedia($store['logo']); + if($li['fkid']){ + $li['title'] = pdo_getcolumn(PDO_NAME.'halfcardlist',array('uniacid'=>$_W['uniacid'],'id'=>$li['fkid']),'title'); + }else{ + $li['title'] = $store['storename'].'买家在线买单'; + } + $li['paytime'] = date('Y-m-d H:i:s',$li['paytime']); + } + + include wl_template('order/payonlinelist'); + } + //导出买单信息列表 + public function exportpayonline($where){ + global $_W, $_GPC; + $payonlinelist = Util::getNumData('*','wlmerchant_order',$where,'paytime DESC',0,0,1); + $pager = $payonlinelist[1]; + $list = $payonlinelist[0]; + foreach ($list as $key => &$li) { + $member = pdo_get('wlmerchant_member',array('id' => $li['mid']),array('mobile','nickname')); + $li['mobile'] = $member['mobile']; + $li['nickname'] = $member['nickname']; + $store = pdo_get(PDO_NAME.'merchantdata',array('uniacid'=>$_W['uniacid'],'id'=>$li['sid']),array('logo','storename')); + if($li['fkid']){ + $li['title'] = pdo_getcolumn(PDO_NAME.'halfcardlist',array('uniacid'=>$_W['uniacid'],'id'=>$li['fkid']),'title'); + }else{ + $li['title'] = $store['storename'].'买家在线买单'; + } + $li['paytime'] = date('Y-m-d H:i:s',$li['paytime']); + $li['orderno'] = "\t".$li['orderno']."\t"; + } + + /* 输出表头 */ + $filter = array( + 'orderno' => '订单号', + 'title' => '所属商家', + 'nickname' => '买家昵称', + 'mobile' => '买家电话', + 'goodsprice' => '订单金额', + 'oprice' => '不可优惠金额', + 'spec' => '优惠折扣', + 'card_fee' => '已优惠金额', + 'price' => '实付金额', + 'paytype' => '支付方式', + 'paytime' => '支付时间' + ); + + $data = array(); + for ($i=0; $i < count($list) ; $i++) { + foreach ($filter as $key => $title) { + if($key == 'paytype'){ + switch ($list[$i][$key]) { + case '1': + $data[$i][$key] = '余额支付'; + break; + case '2': + $data[$i][$key] = '微信支付'; + break; + case '3': + $data[$i][$key] = '支付宝支付'; + break; + case '4': + $data[$i][$key] = '货到付款'; + break; + default: + $data[$i][$key] = '其他或未支付'; + break; + } + }else if($key == 'spec'){ + if($list[$i][$key] < 10){ + $data[$i][$key] = $list[$i][$key].'折'; + }else{ + $data[$i][$key] = '无折扣'; + } + } else { + $data[$i][$key] = $list[$i][$key]; + } + + } + } + util_csv::export_csv_2($data,$filter,'在线买单记录表.csv'); + exit(); + + } + + +} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/controller/order/orderSet.ctrl.php b/addons/weliam_smartcity/sys/controller/order/orderSet.ctrl.php new file mode 100644 index 0000000..786ae43 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/order/orderSet.ctrl.php @@ -0,0 +1,25 @@ + $_W['uniacid']),array('id','agentname')); + //端口判断 + if(is_agent()){ + $where .= " and aid = {$_W['aid']}"; + $where2 .= " and a.aid = {$_W['aid']}"; + } + if(is_store()){ + $where .= " and sid = {$_W['storeid']}"; + $where2 .= " and a.sid = {$_W['storeid']}"; + } + //状态 + if($_GPC['status']){ + if($_GPC['status'] == 'zero'){ + $where .= " and status = 0"; + $where2 .= " and a.status = 0"; + }else if(intval($_GPC['status']) == 11){ + $where .= " and status IN (1,2,3,4,6,8,9)"; + $where2 .= " and a.status IN (1,2,3,4,6,8,9)"; + }else if(intval($_GPC['status']) == 12){ + $where .= " and status IN (2,3)"; + $where2 .= " and a.status IN (2,3)"; + }else if(intval($_GPC['status']) == 13){ + $where .= " and status IN (0,1,2,3,4,6,8,9)"; + $where2 .= " and a.status IN (0,1,2,3,4,6,8,9)"; + }else{ + $where .= " and status = {$_GPC['status']} "; + $where2 .= " and a.status = {$_GPC['status']} "; + } + } + //支付方式 + if($_GPC['paytype']){ + $where .= " and paytype = {$_GPC['paytype']} "; + $where2 .= " and a.paytype = {$_GPC['paytype']} "; + } + //所属代理 + if($_GPC['agentid'] != 0){ + if($_GPC['agentid'] == -1){ + $where .= " and aid = 0 "; + $where2 .= " and a.aid = 0 "; + }else{ + $where .= " and aid = {$_GPC['agentid']} "; + $where2 .= " and a.aid = {$_GPC['agentid']} "; + } + } + if($_GPC['keyword']){ + $keyword = trim($_GPC['keyword']); + if($_GPC['keywordtype'] == 1){ + $where .= " and orderno LIKE '%{$keyword}%'"; + $where2 .= " and a.orderno LIKE '%{$keyword}%'"; + }else if($_GPC['keywordtype'] == 3){ + $where .= " and mid = '{$keyword}'"; + $where2 .= " and a.mid = '{$keyword}'"; + }else if($_GPC['keywordtype'] == 4){ + $where .= " and sid = '{$keyword}'"; + $where2 .= " and a.sid = '{$keyword}'"; + }else if($_GPC['keywordtype'] == 5){ + $params[':name'] = "%{$keyword}%"; + $members = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_member')." WHERE uniacid = {$_W['uniacid']} AND nickname LIKE :name",$params); + if($members){ + $mids = "("; + foreach ($members as $key => $v) { + if($key == 0){ + $mids.= $v['id']; + }else{ + $mids.= ",".$v['id']; + } + } + $mids.= ")"; + $where .= " and mid IN {$mids}"; + $where2 .= " and a.mid IN {$mids}"; + } + }else if($_GPC['keywordtype'] == 6){ + $params[':name'] = "%{$keyword}%"; + $members = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_member')." WHERE uniacid = {$_W['uniacid']} AND mobile LIKE :name",$params); + if($members){ + $mids = "("; + foreach ($members as $key => $v) { + if($key == 0){ + $mids.= $v['id']; + }else{ + $mids.= ",".$v['id']; + } + } + $mids.= ")"; + + $where .= " and (mid IN {$mids} OR mobile LIKE '%{$keyword}%') "; + $where2 .= " and (a.mid IN {$mids} OR a.mobile LIKE '%{$keyword}%') "; + }else{ + //可以通过当前订单所使用的手机进行查询 + $where .= " and mobile LIKE '%{$keyword}%' "; + $where2 .= " and a.mobile LIKE '%{$keyword}%' "; + } + + }else if($_GPC['keywordtype'] == 7){ + $params[':name'] = "%{$keyword}%"; + $members = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_merchantdata')." WHERE uniacid = {$_W['uniacid']} AND storename LIKE :name",$params); + if($members){ + $mids = "("; + foreach ($members as $key => $v) { + if($key == 0){ + $mids.= $v['id']; + }else{ + $mids.= ",".$v['id']; + } + } + $mids.= ")"; + $where .= " and sid IN {$mids}"; + $where2 .= " and a.sid IN {$mids}"; + } + }else if($_GPC['keywordtype'] == 8){ + //核销码 + $smorder = pdo_get(PDO_NAME.'smallorder',array('checkcode'=>$keyword),array('orderid','plugin')); + if($smorder){ + if($smorder['plugin'] == 'rush'){ + $where .= " AND id = {$smorder['orderid']} "; + $where2 .= " AND a.id = 0"; + }else{ + $where .= " AND id = 0 "; + $where2 .= " AND a.id = {$smorder['orderid']}"; + } + }else{ + $where .= " AND checkcode = '{$keyword}' "; + $where2 .= " AND (f.qrcode = {$keyword} OR g.qrcode = {$keyword} OR `c`.concode = {$keyword} OR b.qrcode = {$keyword}) "; + } + }else if($_GPC['keywordtype'] == 9){ + $keyword = "'%{$keyword}%'"; + $where .= " AND mobile like {$keyword} "; + $where2 .= " AND a.mobile like {$keyword} "; + + }else if($_GPC['keywordtype'] == 10){ + $saleman = pdo_get('wlmerchant_merchantuser',array('id' => $keyword),array('createtime','storeid')); + $where .= " and sid = {$saleman['storeid']} and createtime > {$saleman['createtime']}"; + $where2 .= " and a.sid = {$saleman['storeid']} and createtime > {$saleman['createtime']}"; + } + } + //时间 + if (!empty($_GPC['time_limit']) && $_GPC['timetype'] ) { + $starttime = strtotime($_GPC['time_limit']['start']); + $endtime = strtotime($_GPC['time_limit']['end']); + if($_GPC['timetype'] == 1){ + $where .= " and createtime > {$starttime} and createtime < {$endtime}"; + $where2 .= " and a.createtime > {$starttime} and a.createtime < {$endtime}"; + }else{ + $where .= " and paytime > {$starttime} and paytime < {$endtime}"; + $where2 .= " and a.paytime > {$starttime} and a.paytime < {$endtime}"; + } + } + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + //插件 + if($_GPC['plugin']){ + $plugin = $_GPC['plugin']; + //关键字 + if($plugin == 'rush'){ + $where2 .= " AND a.plugin IN ('null') "; + }else{ + $where2 .= " AND a.plugin = '{$plugin}' "; + $where .= " and orderno = 00000 "; + } + }else{ + $where2 .= " AND a.plugin IN ('wlfightgroup','groupon','coupon','activity','bargain','citydelivery') "; + } + if($_GPC['keywordtype'] == 2 && $_GPC['keyword'] && $_GPC['plugin'] != 'citydelivery'){ + $where .= " and activityid = {$keyword} "; + $where2 .= " and a.fkid = {$keyword} "; + } + if($_GPC['keywordtype'] == 2 && $_GPC['keyword'] && $_GPC['plugin'] == 'citydelivery'){ + $desmorder = pdo_getall(PDO_NAME.'delivery_order',array('gid'=>$keyword),array('tid')); + if($desmorder){ + $ids = "("; + foreach ($desmorder as $key => $v) { + $id = pdo_getcolumn(PDO_NAME.'order',array('orderno'=>$v['tid']),'id'); + if($key == 0){ + $ids.= $id; + }else{ + $ids.= ",".$id; + } + } + $ids.= ")"; + $where2 .= " and a.id IN {$ids}"; + }else{ + $where2 .= " and a.id IN (0)"; + } + + } + //拼团 + if($_GPC['fightgroupid']){ + $where2 .= " and a.fightgroupid = {$_GPC['fightgroupid']} "; + } + //获取自定义表单信息 + if($_GPC['keywordtype'] == 2 && !empty($plugin) && !empty($keyword)){ + if($plugin == 'rush'){ + $diyformid = pdo_getcolumn(PDO_NAME.'rush_activity',array('uniacid'=>$_W['uniacid'],'id'=>$keyword),'diyformid'); + }else if($plugin == 'groupon'){ + $diyformid = pdo_getcolumn(PDO_NAME.'groupon_activity',array('uniacid'=>$_W['uniacid'],'id'=>$keyword),'diyformid'); + }else if($plugin == 'wlfightgroup'){ + $diyformid = pdo_getcolumn(PDO_NAME.'fightgroup_goods',array('uniacid'=>$_W['uniacid'],'id'=>$keyword),'diyformid'); + }else if($plugin == 'bargain'){ + $diyformid = pdo_getcolumn(PDO_NAME.'bargain_activity',array('uniacid'=>$_W['uniacid'],'id'=>$keyword),'diyformid'); + }else if($plugin == 'activity'){ + $diyformid = pdo_getcolumn(PDO_NAME.'activitylist',array('uniacid'=>$_W['uniacid'],'id'=>$keyword),'diyformid'); + } + } + if(empty($diyformid)){ + $diyformid = 0; + } + + + //导出 + if($_GPC['export']){ + $this -> export($where,$where2,$diyformid); + } + #2、列表获取 + $orderField = 'id,aid,mobile,createtime,sid,status,paidprid,mid,fullreducemoney,orderno,num,price,vip_card_id,paytype,vipbuyflag,paytime,changedispatchprice,changeprice,disorderid,applyrefund + ,plugin,payfor,fkid as goods_id,blendcredit,redpackmoney,"a" as a'; + $rushOrderField = 'id,aid,mobile,createtime,sid,status,paidprid,mid,fullreducemoney,orderno,num,price,vip_card_id,paytype,vipbuyflag,paytime,changedispatchprice,changeprice,disorderid,applyrefund + ,"rush" as plugin,"rush" as payfor,activityid as goods_id,blendcredit,redpackmoney,"b" as a'; + $orderBy = ' ORDER BY createtime DESC '; + $limit = " LIMIT {$pageStart},{$psize} "; + $orderT = tablename(PDO_NAME."order"); + $rushOrderT = tablename(PDO_NAME."rush_order"); + $orderW = str_replace('a.','',$where2); + $orderlist = pdo_fetchall("SELECT {$orderField} FROM ".$orderT.$orderW + ." UNION ALL SELECT {$rushOrderField} FROM ".$rushOrderT.$where.$orderBy.$limit); + + #3、循环处理列表数据 + foreach ($orderlist as $key => &$v) { + //商品信息获取 + switch ($v['plugin']) { + case 'rush': + //商品信息获取 + $goods = pdo_get(PDO_NAME . "rush_activity" , ['id' => $v['goods_id']] , ['name','pftid','price','vipprice','thumb' , 'id' , 'isdistri' , 'cutofftime' , 'unit']); + $v['unit'] = $goods['unit']; + $v['isdistri'] = $goods['isdistri']; + $v['mobile'] = $goods['mobile']; + $v['goodsimg'] = tomedia($goods['thumb']); + $v['goodsname'] = $goods['name']; + //其他信息处理 + $v['goodsprice'] = sprintf("%.2f" , $v['price'] / $v['num']); + $v['plugintext'] = '抢购'; + $v['plugincss'] = 'success'; + $v['detailurl'] = web_url("order/wlOrder/orderdetail" , ['orderid' => $v['id'] , 'type' => 1]); + $rushorder = pdo_get(PDO_NAME.'rush_order', array('id'=>$v['id'],'uniacid'=>$_W['uniacid']),array('mid','activityid','discount','username','mobile','optionid','neworderflag','dkmoney','actualprice','remark','adminremark','expressid')); + $v['actualprice'] = $rushorder['actualprice']; + if($rushorder['optionid']){ + $v['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$rushorder['optionid']),'title'); + } + $v['remark'] = $rushorder['adminremark']; + $v['buyremark'] = $rushorder['remark']; + $v['expressid'] = $rushorder['expressid']; + //积分抵扣 + $v['dkmoney'] = $rushorder['dkmoney']; + //VIP折扣 + if ($v['vipbuyflag']) { + if($rushorder['discount'] > 0){ + $v['vipdiscount'] = $rushorder['discount']; + }else{ + if ($rushorder['optionid']) { + $option = pdo_get('wlmerchant_goods_option',array('id' => $rushorder['optionid']),array('price','vipprice')); + $v['vipdiscount'] = sprintf("%.2f" , $option['price'] - $option['vipprice']); + } + else { + $v['vipdiscount'] = sprintf("%.2f" , $goods['price'] - $goods['vipprice']); + } + } + } + $encodename = pdo_getcolumn(PDO_NAME . 'member',['id' => $rushorder['mid']],'encodename'); + //用户信息 + $v['username'] = $encodename ? base64_decode($encodename) : $rushorder['username']; + $v['mobile'] = $rushorder['mobile']; + //校验 + $v['pftflag'] = $goods['pftid']; + break;//抢购 + case 'groupon': + //商品信息获取 + $goods = pdo_get('wlmerchant_groupon_activity' , ['id' => $v['goods_id']] , ['name','price','vipprice' , 'isdistri' ,'pftid', 'thumb' , 'id' , 'unit']); + $v['goodsname'] = $goods['name']; + $v['isdistri'] = $goods['isdistri']; + $v['unit'] = $goods['unit']; + $v['goodsimg'] = tomedia($goods['thumb']); + //其他信息处理 + $v['actualprice'] = $v['price']; + $v['plugintext'] = '团购'; + $v['plugincss'] = 'info'; + $v['detailurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$v['id'],'type'=>10)); + $ndorder = pdo_get(PDO_NAME.'order', array('id'=>$v['id'],'uniacid'=>$_W['uniacid']),array('vipdiscount','cerditmoney','id','name','mobile','fightgroupid','payfor','plugin','fkid','specid','fightstatus','expressid','recordid','goodsprice','card_fee','remark','buyremark')); + $v['price'] = $ndorder['goodsprice']; + $v['goodsprice'] = sprintf("%.2f",$ndorder['goodsprice']/$v['num']); + if($ndorder['specid']){ + $v['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$ndorder['specid']),'title'); + } + //VIP折扣 + if ($v['vipbuyflag']) { + if($ndorder['vipdiscount'] > 0){ + $v['vipdiscount'] = $ndorder['vipdiscount']; + }else { + if ($ndorder['specid']) { + $option = pdo_get('wlmerchant_goods_option', array('id' => $ndorder['specid']), array('price', 'vipprice')); + $v['vipdiscount'] = sprintf("%.2f", $option['price'] - $option['vipprice']); + } else { + $v['vipdiscount'] = sprintf("%.2f", $goods['price'] - $goods['vipprice']); + } + } + } + $v['expressid'] = $ndorder['expressid']; + $v['buyremark'] = $ndorder['buyremark']; + $v['remark'] = $ndorder['remark']; + $v['dkmoney'] = $ndorder['cerditmoney']; + $v['pftflag'] = $goods['pftid']; + break;//团购 + case 'wlfightgroup': + $goods = Wlfightgroup::getSingleGood($v['goods_id'],'name,logo,id,unit,vipdiscount,isdistri'); + $ndorder = pdo_get(PDO_NAME . 'order' , ['id' => $v['id'] , 'uniacid' => $_W['uniacid']] , ['cerditmoney','vipdiscount','id' , 'name' , 'mobile' , 'fightgroupid' , 'payfor' , 'plugin' , 'fkid' , 'specid' , 'fightstatus' , 'expressid' , 'recordid' , 'goodsprice' , 'card_fee' , 'remark' , 'buyremark']); + $group = pdo_get(PDO_NAME.'fightgroup_group',array('id' => $ndorder['fightgroupid'])); + if($group['status'] == 1 && $v['status'] == 1){ + $v['status'] = 10; + } + $v['expressid'] = $ndorder['expressid']; + $v['goodsname'] = $goods['name']; + $v['isdistri'] = $goods['isdistri']; + $v['unit'] = $goods['unit']; + $v['goodsimg'] = tomedia($goods['logo']); + $v['actualprice'] = $v['price']; + $v['price'] = $ndorder['goodsprice'] ; + $v['goodsprice'] = sprintf("%.2f",$ndorder['goodsprice']/$v['num']); + $v['plugintext'] = '拼团'; + $v['plugincss'] = 'warning'; + $v['detailurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$v['id'],'type'=>2)); + if($ndorder['specid']){ + $v['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$ndorder['specid']),'title'); + } + //会员减免 + if($v['vipbuyflag']){ + if($ndorder['vipdiscount'] > 0){ + $v['vipdiscount'] = $ndorder['vipdiscount']; + }else { + $v['vipdiscount'] = sprintf("%.2f", $goods['vipdiscount'] * $v['num']); + } + } + //积分抵扣 + $v['dkmoney'] = $ndorder['cerditmoney']; + $v['buyremark'] = $ndorder['buyremark']; + $v['remark'] = $ndorder['remark']; + break;//拼团 + case 'coupon': + $goods = wlCoupon::getSingleCoupons($v['goods_id'],'title,vipprice,price,logo,id,isdistri'); + $ndorder = pdo_get(PDO_NAME . 'order' , ['id' => $v['id'] , 'uniacid' => $_W['uniacid']] , ['cerditmoney','vipdiscount','id' , 'name' , 'mobile' , 'fightgroupid' , 'payfor' , 'plugin' , 'fkid' , 'specid' , 'fightstatus' , 'expressid' , 'recordid' , 'goodsprice' , 'card_fee' , 'remark' , 'buyremark']); + $v['goodsname'] = $goods['title']; + $v['isdistri'] = $goods['isdistri']; + $v['unit'] = '张'; + $v['goodsimg'] = tomedia($goods['logo']); + $v['actualprice'] = $v['price']; + $v['price'] = $ndorder['goodsprice'] ; + $v['goodsprice'] = sprintf("%.2f",$ndorder['goodsprice']/$v['num']); + $v['plugintext'] = '卡券'; + $v['plugincss'] = 'danger'; + $v['detailurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$v['id'],'type'=>3)); + $v['expressid'] = $ndorder['expressid']; + $v['buyremark'] = $ndorder['buyremark']; + $v['remark'] = $ndorder['remark']; + $v['dkmoney'] = $ndorder['cerditmoney']; + //VIP折扣 + if ($v['vipbuyflag']) { + if($ndorder['vipdiscount'] > 0){ + $v['vipdiscount'] = $ndorder['vipdiscount']; + }else { + $v['vipdiscount'] = sprintf("%.2f", $goods['price'] - $goods['vipprice']); + } + } + break;//卡卷 + case 'bargain': + $goods = pdo_get('wlmerchant_bargain_activity',array('id' => $v['goods_id']),array('name','isdistri','thumb','id','unit')); + $ndorder = pdo_get(PDO_NAME . 'order' , ['id' => $v['id'] , 'uniacid' => $_W['uniacid']] , ['cerditmoney','id' , 'name' , 'mobile' , 'fightgroupid' , 'payfor' , 'plugin' , 'fkid' , 'specid' , 'fightstatus' , 'expressid' , 'recordid' , 'goodsprice' , 'card_fee' , 'remark' , 'buyremark']); + $v['goodsname'] = $goods['name']; + $v['isdistri'] = $goods['isdistri']; + $v['unit'] = $goods['unit']; + $v['goodsimg'] = tomedia($goods['thumb']); + $v['actualprice'] = $v['price']; + $v['price'] = $ndorder['goodsprice'] ; + $v['goodsprice'] = sprintf("%.2f",$ndorder['goodsprice']/$v['num']); + $v['plugintext'] = '砍价'; + $v['plugincss'] = 'primary'; + $v['detailurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$v['id'],'type'=>12)); + $v['expressid'] = $ndorder['expressid']; + $v['buyremark'] = $ndorder['buyremark']; + $v['remark'] = $ndorder['remark']; + $v['dkmoney'] = $ndorder['cerditmoney']; + break;//砍价 + case 'citydelivery': + $store = pdo_get('wlmerchant_merchantdata',array('id' => $v['sid']),array('storename','logo','id')); + $ndorder = pdo_get(PDO_NAME . 'order' , ['id' => $v['id'] , 'uniacid' => $_W['uniacid']] , ['cerditmoney','id','name','mobile','plugin','expressid','goodsprice','remark','buyremark','redpackmoney','vipdiscount','expressprcie','packingmoney']); + $v['goodsname'] = '['.$store['storename'].']配送商品'; + $v['goodsimg'] = tomedia($store['logo']); + $v['actualprice'] = $v['price']; + $v['price'] = $v['goodsprice'] = $ndorder['goodsprice']; + $v['plugintext'] = '同城配送'; + $v['plugincss'] = 'success'; + $v['detailurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$v['id'],'type'=>14)); + $v['expressid'] = $ndorder['expressid']; + $v['buyremark'] = $ndorder['buyremark']; + $v['remark'] = $ndorder['remark']; + $v['vipdiscount'] = $ndorder['vipdiscount']; + $v['express']['expressprice'] = $ndorder['expressprcie']; + $v['packingmoney'] = $ndorder['packingmoney']; + $v['num'] = 1; + $v['dkmoney'] = $ndorder['cerditmoney']; + break;//同城配送 + case 'activity': + //商品信息获取 + $goods = pdo_get('wlmerchant_activitylist' , ['id' => $v['goods_id']] , ['title','price','vipprice' , 'isdistri' , 'thumb' , 'id']); + $v['goodsname'] = $goods['title']; + $v['isdistri'] = $goods['isdistri']; + $v['goodsimg'] = tomedia($goods['thumb']); + //其他信息处理 + $v['actualprice'] = $v['price']; + $v['plugintext'] = '活动'; + $v['plugincss'] = 'primary'; + $v['detailurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$v['id'],'type'=>9)); + + + $ndorder = pdo_get(PDO_NAME.'order', array('id'=>$v['id'],'uniacid'=>$_W['uniacid']),array('cerditmoney','vipdiscount','id','name','mobile','fightgroupid','payfor','plugin','fkid','specid','fightstatus','expressid','recordid','goodsprice','card_fee','remark','buyremark')); + $v['price'] = $ndorder['goodsprice']; + $v['goodsprice'] = sprintf("%.2f",$ndorder['goodsprice']/$v['num']); + if($ndorder['specid']>0){ + $option = pdo_get(PDO_NAME.'activity_spec',array('id'=>$ndorder['specid']),['name','vipprice']); + $v['optiontitle'] = $option['name']; + } + //VIP折扣 + if ($v['vipbuyflag']) { + if($ndorder['vipdiscount'] > 0){ + $v['vipdiscount'] = $ndorder['vipdiscount']; + }else { + if($ndorder['specid']>0){ + $v['vipdiscount'] = $goods['vipprice']; + }else{ + $v['vipdiscount'] = $option['vipprice']; + } + } + } + $v['buyremark'] = $ndorder['buyremark']; + $v['remark'] = $ndorder['remark']; + $v['dkmoney'] = $ndorder['cerditmoney']; + break;//活动 + case 'rights': + # 权益商品名称 + $rightsInfo = Rights::getRightsInfo($v['payfor'],$v['goods_id']); + $goodsname = $rightsInfo['name']; + $v['goodsname'] = $goodsname; + # + $v['actualprice'] = $v['price']; + $v['plugintext'] = '权益'; + $v['plugincss'] = 'rights'; + $v['detailurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$v['id'],'type'=>20)); + $v['goodsprice'] = $v['price']; + break;#权益 + } + //代理名称 + if($v['aid'] > 0 ){ + $v['agentname'] = pdo_getcolumn(PDO_NAME.'agentusers', array('id'=>$v['aid'],'uniacid'=>$_W['uniacid']),'agentname'); + }else{ + $v['agentname'] = '总后台'; + } + //商户名称 + $v['merchantName'] = pdo_getcolumn(PDO_NAME.'merchantdata', array('id'=>$v['sid'],'uniacid'=>$_W['uniacid']),'storename'); + //用户数据 + $member = pdo_get(PDO_NAME.'member', array('id'=>$v['mid']),array('nickname','avatar','mobile','realname','encodename')); + if(!empty($v['username'])){ + $member['realname'] = $v['username']; + $member['nickname'] = base64_decode($member['encodename']); + } + if(!empty($v['mobile'])){ + $member['mobile'] = $v['mobile']; + } + $v['member'] = $member; + //快递信息获取 + if($v['expressid'] && $v['plugin'] != 'citydelivery'){ + $v['express'] = pdo_get(PDO_NAME.'express',array('id'=>$v['expressid']),array('id','expressprice','expressname','expresssn')); + } + $v['merchname'] = pdo_getcolumn(PDO_NAME.'merchantdata',array('id'=>$v['sid']),'storename'); + //分销信息获取 + if($v['disorderid']){ + $disorder = pdo_get('wlmerchant_disorder',array('id' => $v['disorderid'])); + $v['disorderstatus'] = $disorder['status']; + $leadmoney = unserialize($disorder['leadmoney']); + if($disorder['twoleadid']){ + $v['level'] = '2'; + }else{ + $v['level'] = '1'; + } + $v['onecommission'] = $leadmoney['one']; + $onecom = pdo_get(PDO_NAME.'distributor',array('id'=>$disorder['oneleadid']),array('nickname','mid')); + $v['onecomname'] = $onecom['nickname']; + $v['onecommid'] = $onecom['mid']; + $v['twocommission'] = $leadmoney['two']; + $twocom = pdo_get(PDO_NAME.'distributor',array('id'=>$disorder['twoleadid']),array('nickname','mid')); + $v['twocomname'] = $twocom['nickname']; + $v['twocommid'] = $twocom['mid']; + $v['commission'] = sprintf("%.2f",$v['onecommission']+$v['twocommission']); + } + //同时开通一卡通 + if($v['vip_card_id'] > 0){ + $v['vipCardPrice'] = pdo_getcolumn(PDO_NAME.'halfcard_type',array('id'=>$v['vip_card_id']),'price'); + } + //售后 + $v['refundflag'] = pdo_getcolumn(PDO_NAME.'aftersale',array('uniacid'=>$_W['uniacid'],'status'=>1,'orderno'=>$v['orderno']),'id'); + //混合支付 + if($v['blendcredit'] > 0){ + $v['paytype'] = 7; + $v['blendwx'] = sprintf("%.2f",$v['actualprice'] - $v['blendcredit']); + } + //状态 + switch ($v['status']){ + case '0': + $v['statuscss'] = 'defualt'; + $v['statustext'] = '未支付'; + break; + case '1': + $v['statuscss'] = 'info'; + $v['statustext'] = '已支付'; + break; + case '2': + $v['statuscss'] = 'success'; + $v['statustext'] = '待评价'; + break; + case '3': + $v['statuscss'] = 'success'; + $v['statustext'] = '已完成'; + break; + case '4': + $v['statuscss'] = 'success'; + $v['statustext'] = '待收货'; + break; + case '5': + $v['statuscss'] = 'defualt'; + $v['statustext'] = '已取消'; + break; + case '6': + $v['statuscss'] = 'warning'; + $v['statustext'] = '待退款'; + break; + case '7': + $v['statuscss'] = 'defualt'; + $v['statustext'] = '已退款'; + break; + case '8': + $v['statuscss'] = 'info'; + $v['statustext'] = '待发货'; + break; + case '9': + $v['statuscss'] = 'danger'; + $v['statustext'] = '已过期'; + break; + case '10': + $v['statuscss'] = 'info'; + $v['statustext'] = '组团中'; + break; + default: + $v['statuscss'] = 'danger'; + $v['statustext'] = '错误状态'; + break; + } + } + #4、获取总共的统计信息 + $orderStatistics = pdo_fetch("SELECT COUNT(id) as order_total,SUM(num) as goods_total,SUM(price) as price_total FROM " . $orderT . $orderW ); + $rushOrderStatistics = pdo_fetch('SELECT COUNT(id) as order_total,SUM(num) as goods_total,SUM(actualprice) as price_total FROM ' . $rushOrderT . $where); + $total = $orderStatistics['order_total'] + $rushOrderStatistics['order_total']; + $goodtotal = $orderStatistics['goods_total'] + $rushOrderStatistics['goods_total']; + $allprice = sprintf("%.2f" , $orderStatistics['price_total'] + $rushOrderStatistics['price_total']); + #5、分页 + $pager = wl_pagination($total, $pindex, $psize); + + + /*#1、获取基本参数信息 + $pindex = max(1, intval($_GPC['page'])); + $psize = 10; + $where = " where uniacid = {$_W['uniacid']} and orderno != 666666"; + $where2 = " where a.uniacid = {$_W['uniacid']} and a.orderno != 666666"; + if(is_agent()){ + $where .= " and aid = {$_W['aid']}"; + $where2 .= " and a.aid = {$_W['aid']}"; + } + if(is_store()){ + $where .= " and sid = {$_W['storeid']}"; + $where2 .= " and a.sid = {$_W['storeid']}"; + } + + //状态 + if($_GPC['status']){ + if($_GPC['status'] == 'zero'){ + $where .= " and status = 0"; + $where2 .= " and a.status = 0"; + }else if(intval($_GPC['status']) == 10){ + $where .= " and applyrefund = 1 and status IN (1,8)"; + $where2 .= " and a.applyrefund = 1 and a.status IN (1,8)"; + }else if(intval($_GPC['status']) == 11){ + $where .= " and status IN (1,2,3,4,6,8,9)"; + $where2 .= " and a.status IN (1,2,3,4,6,8,9)"; + }else if(intval($_GPC['status']) == 12){ + $where .= " and status IN (2,3)"; + $where2 .= " and a.status IN (2,3)"; + }else if(intval($_GPC['status']) == 13){ + $where .= " and status IN (0,1,2,3,4,6,8,9)"; + $where2 .= " and a.status IN (0,1,2,3,4,6,8,9)"; + }else{ + $where .= " and status = {$_GPC['status']} "; + $where2 .= " and a.status = {$_GPC['status']} "; + } + } + //支付方式 + if($_GPC['paytype']){ + $where .= " and paytype = {$_GPC['paytype']} "; + $where2 .= " and a.paytype = {$_GPC['paytype']} "; + } + if($_GPC['keyword']){ + $keyword = $_GPC['keyword']; + if($_GPC['keywordtype'] == 1){ + $where .= " and orderno LIKE '%{$keyword}%'"; + $where2 .= " and a.orderno LIKE '%{$keyword}%'"; + }else if($_GPC['keywordtype'] == 3){ + $where .= " and mid = '{$keyword}'"; + $where2 .= " and a.mid = '{$keyword}'"; + }else if($_GPC['keywordtype'] == 4){ + $where .= " and sid = '{$keyword}'"; + $where2 .= " and a.sid = '{$keyword}'"; + }else if($_GPC['keywordtype'] == 5){ + $params[':name'] = "%{$keyword}%"; + $members = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_member')." WHERE uniacid = {$_W['uniacid']} AND nickname LIKE :name",$params); + if($members){ + $mids = "("; + foreach ($members as $key => $v) { + if($key == 0){ + $mids.= $v['id']; + }else{ + $mids.= ",".$v['id']; + } + } + $mids.= ")"; + $where .= " and mid IN {$mids}"; + $where2 .= " and a.mid IN {$mids}"; + } + }else if($_GPC['keywordtype'] == 6){ + $params[':name'] = "%{$keyword}%"; + $members = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_member')." WHERE uniacid = {$_W['uniacid']} AND mobile LIKE :name",$params); + if($members){ + $mids = "("; + foreach ($members as $key => $v) { + if($key == 0){ + $mids.= $v['id']; + }else{ + $mids.= ",".$v['id']; + } + } + $mids.= ")"; + + $where .= " and (mid IN {$mids} OR mobile LIKE '%{$keyword}%') "; + $where2 .= " and (a.mid IN {$mids} OR a.mobile LIKE '%{$keyword}%') "; + }else{ + //可以通过当前订单所使用的手机进行查询 + $where .= " and mobile LIKE '%{$keyword}%' "; + $where2 .= " and a.mobile LIKE '%{$keyword}%' "; + } + + }else if($_GPC['keywordtype'] == 7){ + $params[':name'] = "%{$keyword}%"; + $members = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_merchantdata')." WHERE uniacid = {$_W['uniacid']} AND storename LIKE :name",$params); + if($members){ + $mids = "("; + foreach ($members as $key => $v) { + if($key == 0){ + $mids.= $v['id']; + }else{ + $mids.= ",".$v['id']; + } + } + $mids.= ")"; + $where .= " and sid IN {$mids}"; + $where2 .= " and a.sid IN {$mids}"; + } + }else if($_GPC['keywordtype'] == 8){ + //核销码 + $smorder = pdo_get(PDO_NAME.'smallorder',array('checkcode'=>$keyword),array('orderid','plugin')); + if($smorder){ + if($smorder['plugin'] == 'rush'){ + $where .= " AND id = {$smorder['orderid']} "; + $where2 .= " AND a.id = 0"; + }else{ + $where .= " AND id = 0 "; + $where2 .= " AND a.id = {$smorder['orderid']}"; + } + }else{ + $where .= " AND checkcode = {$keyword} "; + $where2 .= " AND (f.qrcode = {$keyword} OR g.qrcode = {$keyword} OR `c`.concode = {$keyword} OR b.qrcode = {$keyword}) "; + } + }else if($_GPC['keywordtype'] == 9){ + $keyword = "'%{$keyword}%'"; + $where .= " AND mobile like {$keyword} "; + $where2 .= " AND a.mobile like {$keyword} "; + + }else if($_GPC['keywordtype'] == 10){ + $params[':name'] = "%{$keyword}%"; + $members = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_merchantdata')." WHERE uniacid = {$_W['uniacid']} AND salesmid LIKE :name",$params); + if($members){ + $mids = "("; + foreach ($members as $key => $v) { + if($key == 0){ + $mids.= $v['id']; + }else{ + $mids.= ",".$v['id']; + } + } + $mids.= ")"; + $where .= " and sid IN {$mids}"; + $where2 .= " and a.sid IN {$mids}"; + } + } + + } + + //时间 + if (!empty($_GPC['time_limit']) && $_GPC['timetype'] ) { + $starttime = strtotime($_GPC['time_limit']['start']); + $endtime = strtotime($_GPC['time_limit']['end']); + if($_GPC['timetype'] == 1){ + $where .= " and createtime > {$starttime} and createtime < {$endtime}"; + $where2 .= " and a.createtime > {$starttime} and a.createtime < {$endtime}"; + }else{ + $where .= " and paytime > {$starttime} and paytime < {$endtime}"; + $where2 .= " and a.paytime > {$starttime} and a.paytime < {$endtime}"; + } + } + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + + + //插件 + if($_GPC['plugin']){ + $plugin = $_GPC['plugin']; + //关键字 + if($plugin == 'rush'){ + $where2 .= " AND a.plugin IN ('null') "; + }else{ + $where2 .= " AND a.plugin = '{$plugin}' "; + $where .= " and orderno = 00000 "; + } + }else{ + $where2 .= " AND a.plugin IN ('wlfightgroup','groupon','coupon','bargain') "; + } + + if($_GPC['keywordtype'] == 2 && $_GPC['keyword']){ + $where .= " and activityid = {$keyword} "; + $where2 .= " and a.fkid = {$keyword} "; + } + //拼团 + if($_GPC['fightgroupid']){ + $where2 .= " and a.fightgroupid = {$_GPC['fightgroupid']} "; + } + //导出 + if($_GPC['export']){ + $this -> export($where,$where2); + } + //统计与分页 + $total1 = pdo_fetchcolumn("SELECT COUNT(a.id) FROM ".tablename(PDO_NAME."order") + ." a LEFT JOIN ".tablename(PDO_NAME."fightgroup_userecord")." f ON a.id = f.orderid AND a.plugin = 'wlfightgroup'" + ." LEFT JOIN ".tablename(PDO_NAME."groupon_userecord")." g ON a.id = g.orderid AND a.plugin = 'groupon'" + ." LEFT JOIN ".tablename(PDO_NAME."member_coupons")." `c` ON a.orderno = `c`.orderno AND a.plugin = 'coupon'" + ." LEFT JOIN ".tablename(PDO_NAME."bargain_userlist")." b ON a.id = b.orderid AND a.plugin = 'bargain' {$where2}"); + $total2 = pdo_fetchcolumn('SELECT COUNT(id) FROM '.tablename(PDO_NAME."rush_order")." {$where}"); + $total = $total1+$total2; + + $goodtotal1 = pdo_fetchcolumn("SELECT SUM(a.num) FROM ".tablename(PDO_NAME."order") + ." a LEFT JOIN ".tablename(PDO_NAME."fightgroup_userecord")." f ON a.id = f.orderid AND a.plugin = 'wlfightgroup'" + ." LEFT JOIN ".tablename(PDO_NAME."groupon_userecord")." g ON a.id = g.orderid AND a.plugin = 'groupon'" + ." LEFT JOIN ".tablename(PDO_NAME."member_coupons")." `c` ON a.orderno = `c`.orderno AND a.plugin = 'coupon'" + ." LEFT JOIN ".tablename(PDO_NAME."bargain_userlist")." b ON a.id = b.orderid AND a.plugin = 'bargain' {$where2}"); + $goodtotal2 = pdo_fetchcolumn('SELECT SUM(num) FROM '.tablename(PDO_NAME."rush_order")." {$where}"); + $goodtotal = $goodtotal1+$goodtotal2; + + //获取总营业额 + $allprice1 = pdo_fetchcolumn("SELECT SUM(a.price) FROM ".tablename(PDO_NAME."order") + ." a LEFT JOIN ".tablename(PDO_NAME."fightgroup_userecord")." f ON a.id = f.orderid AND a.plugin = 'wlfightgroup'" + ." LEFT JOIN ".tablename(PDO_NAME."groupon_userecord")." g ON a.id = g.orderid AND a.plugin = 'groupon'" + ." LEFT JOIN ".tablename(PDO_NAME."member_coupons")." `c` ON a.orderno = `c`.orderno AND a.plugin = 'coupon'" + ." LEFT JOIN ".tablename(PDO_NAME."bargain_userlist")." b ON a.id = b.orderid AND a.plugin = 'bargain' {$where2}"); + $allprice2 = pdo_fetchcolumn('SELECT SUM(actualprice) FROM '.tablename(PDO_NAME."rush_order")." {$where}"); + $allprice = sprintf("%.2f",$allprice1+$allprice2); + //获取订单信息 + $limit = " LIMIT ".($pindex - 1) * $psize . ',' . $psize; + $orderlist = self::getOrderInfo($where,$where2,$limit); + foreach ($orderlist as $key => &$v) { + if($v['a'] == 'a'){ + $ndorder = pdo_get(PDO_NAME.'order', array('id'=>$v['id'],'uniacid'=>$_W['uniacid']),array('id','name','mobile','fightgroupid','payfor','plugin','fkid','specid','fightstatus','expressid','recordid','goodsprice','card_fee','remark','buyremark')); + //修改支付状态 + if(empty($v['paytype'])){ + $paylog = pdo_get('wlmerchant_paylog',array('tid' => $v['orderno']),array('type')); + $v['paytype'] = $paylog['type']; + pdo_update('wlmerchant_order',array('paytype' => $paytype),array('id' => $v['id'])); + } + if($ndorder['plugin'] == 'coupon'){ //卡券 + $goods = wlCoupon::getSingleCoupons($ndorder['fkid'],'title,logo,id,isdistri'); + $v['goodsname'] = $goods['title']; + $v['isdistri'] = $goods['isdistri']; + $v['unit'] = '张'; + $v['goodsimg'] = tomedia($goods['logo']); + $v['actualprice'] = $v['price']; + $v['price'] = $ndorder['goodsprice'] ; + $v['goodsprice'] = sprintf("%.2f",$ndorder['goodsprice']/$v['num']); + $v['plugintext'] = '卡券'; + $v['plugincss'] = 'danger'; + $v['detailurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$v['id'],'type'=>3)); + }else if($ndorder['plugin'] == 'wlfightgroup') { //拼团 + $goods = Wlfightgroup::getSingleGood($ndorder['fkid'],'name,logo,id,unit,vipdiscount,isdistri'); + $group = pdo_get('wlmerchant_fightgroup_group',array('id' => $ndorder['fightgroupid'])); + if($group['status'] == 1 && $v['status'] == 1){ + $v['status'] = 10; + } + $v['goodsname'] = $goods['name']; + $v['isdistri'] = $goods['isdistri']; + $v['unit'] = $goods['unit']; + $v['goodsimg'] = tomedia($goods['logo']); + $v['actualprice'] = $v['price']; + $v['price'] = $ndorder['goodsprice'] ; + $v['goodsprice'] = sprintf("%.2f",$ndorder['goodsprice']/$v['num']); + $v['plugintext'] = '拼团'; + $v['plugincss'] = 'warning'; + $v['detailurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$v['id'],'type'=>2)); + + if($ndorder['specid']){ + $v['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$ndorder['specid']),'title'); + } + //会员减免 + if($v['vipbuyflag']){ + $v['vipdiscount'] = sprintf("%.2f",$goods['vipdiscount']*$v['num']); + } + //积分抵扣 + $v['dkmoney'] = sprintf("%.2f",$ndorder['card_fee']-$v['vipdiscount']); + + }else if($ndorder['plugin'] == 'groupon') { //团购 + $goods = pdo_get('wlmerchant_groupon_activity',array('id' => $ndorder['fkid']),array('name','isdistri','thumb','id','unit')); + $v['goodsname'] = $goods['name']; + $v['isdistri'] = $goods['isdistri']; + $v['unit'] = $goods['unit']; + $v['goodsimg'] = tomedia($goods['thumb']); + $v['actualprice'] = $v['price']; + $v['price'] = $ndorder['goodsprice'] ; + $v['goodsprice'] = sprintf("%.2f",$ndorder['goodsprice']/$v['num']); + $v['plugintext'] = '团购'; + $v['plugincss'] = 'info'; + $v['detailurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$v['id'],'type'=>10)); + if($ndorder['specid']){ + $v['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$ndorder['specid']),'title'); + } + }else if($ndorder['plugin'] == 'bargain') { //砍价 + $goods = pdo_get('wlmerchant_bargain_activity',array('id' => $ndorder['fkid']),array('name','isdistri','thumb','id','unit')); + $v['goodsname'] = $goods['name']; + $v['isdistri'] = $goods['isdistri']; + $v['unit'] = $goods['unit']; + $v['goodsimg'] = tomedia($goods['thumb']); + $v['actualprice'] = $v['price']; + $v['price'] = $ndorder['goodsprice'] ; + $v['goodsprice'] = sprintf("%.2f",$ndorder['goodsprice']/$v['num']); + $v['plugintext'] = '砍价'; + $v['plugincss'] = 'primary'; + $v['detailurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$v['id'],'type'=>12)); + } + + $v['expressid'] = $ndorder['expressid']; + $v['remark'] = $ndorder['remark']; + $v['buyremark'] = $ndorder['buyremark']; + $v['username'] = $ndorder['name']; + $v['mobile'] = $ndorder['mobile']; + $v['goodsid'] = $ndorder['fkid']; + }else{ //抢购 + $rushorder = pdo_get(PDO_NAME.'rush_order', array('id'=>$v['id'],'uniacid'=>$_W['uniacid']),array('activityid','username','mobile','optionid','dkmoney','actualprice','remark','adminremark','expressid')); + //修改支付状态 + if(empty($v['paytype'])){ + $paylog = pdo_get('wlmerchant_paylog',array('tid' => $v['orderno']),array('type')); + $v['paytype'] = $paylog['type']; + pdo_update('wlmerchant_rush_order',array('paytype' => $paytype),array('id' => $v['id'])); + } + $v['activityid'] = pdo_getcolumn(PDO_NAME.'rush_order', array('id'=>$v['id'],'uniacid'=>$_W['uniacid']),'activityid'); + $goods = Rush::getSingleActive($v['activityid'],'name,thumb,id,isdistri,cutofftime,unit'); + $v['unit'] = $goods['unit']; + $v['isdistri'] = $goods['isdistri']; + $v['mobile'] = $goods['mobile']; + $v['goodsimg'] = tomedia($goods['thumb']); + $v['goodsname'] = $goods['name']; + + $v['goodsprice'] = sprintf("%.2f",$v['price']/$v['num']); + $v['actualprice'] = $rushorder['actualprice']; + $v['plugin'] = 'rush'; + $v['plugintext'] = '抢购'; + $v['plugincss'] = 'success'; + $v['detailurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$v['id'],'type'=>1)); + if($rushorder['optionid']){ + $v['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$rushorder['optionid']),'title'); + } + $v['remark'] = $rushorder['adminremark']; + $v['buyremark'] = $rushorder['remark']; + + $v['expressid'] = $rushorder['expressid']; + //积分抵扣 + $v['dkmoney'] = $rushorder['dkmoney']; + //用户信息 + $v['username'] = $rushorder['username']; + $v['mobile'] = $rushorder['mobile']; + $v['goodsid'] = $rushorder['activityid']; + } + + $v['merchantName'] = pdo_getcolumn(PDO_NAME.'merchantdata', array('id'=>$v['sid'],'uniacid'=>$_W['uniacid']),'storename'); + //用户数据 + $member = pdo_get(PDO_NAME.'member', array('id'=>$v['mid']),array('nickname','avatar','mobile','realname')); + if(!empty($v['username'])){ + $member['realname'] = $v['username']; + } + if(!empty($v['mobile'])){ + $member['mobile'] = $v['mobile']; + } + + $v['member'] = $member; + if($v['expressid']){ + $v['express'] = pdo_get(PDO_NAME.'express',array('id'=>$v['expressid']),array('id','expressprice','expressname','expresssn')); + } + if($v['disorderid']){ + $v['merchname'] = pdo_getcolumn(PDO_NAME.'merchantdata',array('id'=>$v['sid']),'storename'); + $disorder = pdo_get('wlmerchant_disorder',array('id' => $v['disorderid'])); + $v['disorderstatus'] = $disorder['status']; + $leadmoney = unserialize($disorder['leadmoney']); + if($disorder['twoleadid']){ + $v['level'] = '2'; + }else{ + $v['level'] = '1'; + } + $v['onecommission'] = $leadmoney['one']; + $onecom = pdo_get(PDO_NAME.'distributor',array('id'=>$disorder['oneleadid']),array('nickname','mid')); + $v['onecomname'] = $onecom['nickname']; + $v['onecommid'] = $onecom['mid']; + $v['twocommission'] = $leadmoney['two']; + $twocom = pdo_get(PDO_NAME.'distributor',array('id'=>$disorder['twoleadid']),array('nickname','mid')); + $v['twocomname'] = $twocom['nickname']; + $v['twocommid'] = $twocom['mid']; + $v['commission'] = sprintf("%.2f",$v['onecommission']+$v['twocommission']); + } + //售后 + $v['refundflag'] = pdo_getcolumn(PDO_NAME.'aftersale',array('uniacid'=>$_W['uniacid'],'status'=>1,'orderno'=>$v['orderno']),'id'); + + + //状态 + switch ($v['status']){ + case '0': + $v['statuscss'] = 'defualt'; + $v['statustext'] = '未支付'; + break; + case '1': + $v['statuscss'] = 'info'; + $v['statustext'] = '已支付'; + break; + case '2': + $v['statuscss'] = 'success'; + $v['statustext'] = '待评价'; + break; + case '3': + $v['statuscss'] = 'success'; + $v['statustext'] = '已完成'; + break; + case '4': + $v['statuscss'] = 'success'; + $v['statustext'] = '待收货'; + break; + case '5': + $v['statuscss'] = 'defualt'; + $v['statustext'] = '已取消'; + break; + case '6': + $v['statuscss'] = 'warning'; + $v['statustext'] = '待退款'; + break; + case '7': + $v['statuscss'] = 'defualt'; + $v['statustext'] = '已退款'; + break; + case '8': + $v['statuscss'] = 'info'; + $v['statustext'] = '待发货'; + break; + case '9': + $v['statuscss'] = 'danger'; + $v['statustext'] = '已过期'; + break; + case '10': + $v['statuscss'] = 'info'; + $v['statustext'] = '组团中'; + break; + default: + $v['statuscss'] = 'danger'; + $v['statustext'] = '错误状态'; + break; + } + } + $pager = wl_pagination($total, $pindex, $psize);*/ + include wl_template('order/orderlist'); + } + + public function export($where,$where2,$diyformid = 0){ + global $_W, $_GPC; + $limit = " LIMIT 20000"; + $orderlist = self::getOrderInfo($where,$where2,$limit); + foreach ($orderlist as $key => &$va) { + if($va['a'] == 'a'){ + $ndorder = pdo_get(PDO_NAME.'order', array('id'=>$va['id'],'uniacid'=>$_W['uniacid']),array('id','payfor','plugin','mobile','orderno','fkid','fightstatus','neworderflag','expressid','recordid','goodsprice','expressprcie','card_fee','remark','buyremark','specid')); + if($ndorder['plugin'] == 'wlfightgroup'){ + $va['plugin'] = '拼团'; + $va['gname'] = pdo_getcolumn(PDO_NAME.'fightgroup_goods',array('id'=>$ndorder['fkid']),'name'); + if($ndorder['specid']){ + $va['option'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$ndorder['specid']),'title'); + } + if($ndorder['recordid']){ + $va['usedtime'] = pdo_getcolumn(PDO_NAME.'fightgroup_userecord',array('id'=>$ndorder['recordid']),'usedtime'); + $va['checkcode'] = pdo_getcolumn(PDO_NAME.'fightgroup_userecord',array('id'=>$ndorder['recordid']),'qrcode'); + } + }else if($ndorder['plugin'] == 'groupon'){ + $va['plugin'] = '团购'; + $va['gname'] = pdo_getcolumn(PDO_NAME.'groupon_activity',array('id'=>$ndorder['fkid']),'name'); + if($ndorder['specid']){ + $va['option'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$ndorder['specid']),'title'); + } + if($ndorder['recordid']){ + $va['usedtime'] = pdo_getcolumn(PDO_NAME.'groupon_userecord',array('id'=>$ndorder['recordid']),'usedtime'); + $va['checkcode'] = pdo_getcolumn(PDO_NAME.'groupon_userecord',array('id'=>$ndorder['recordid']),'qrcode'); + } + }else if($ndorder['plugin'] == 'activity'){ + $va['plugin'] = '活动'; + $va['gname'] = pdo_getcolumn(PDO_NAME.'activitylist',array('id'=>$ndorder['fkid']),'title'); + if($ndorder['specid']){ + $va['option'] = pdo_getcolumn(PDO_NAME.'activity_spec',array('id'=>$ndorder['specid']),'name'); + } + }else if($ndorder['plugin'] == 'coupon'){ + $va['plugin'] = '卡券'; + $va['gname'] = pdo_getcolumn(PDO_NAME.'couponlist',array('id'=>$ndorder['fkid']),'title'); + if($ndorder['recordid']){ + $va['usedtime'] = pdo_getcolumn(PDO_NAME.'member_coupons',array('id'=>$ndorder['recordid']),'usedtime'); + $va['checkcode'] = pdo_getcolumn(PDO_NAME.'member_coupons',array('id'=>$ndorder['recordid']),'concode'); + } + }else if($ndorder['plugin'] == 'bargain'){ + $va['plugin'] = '砍价'; + $va['gname'] = pdo_getcolumn(PDO_NAME.'bargain_activity',array('id'=>$ndorder['fkid']),'name'); + $va['usedtime'] = pdo_getcolumn(PDO_NAME.'bargain_userlist',array('id'=>$ndorder['specid']),'usedtime'); + $va['checkcode'] = pdo_getcolumn(PDO_NAME.'bargain_userlist',array('id'=>$ndorder['specid']),'qrcode'); + }else if($ndorder['plugin'] == 'citydelivery'){ + $va['plugin'] = '同城配送'; + $smallorders = pdo_fetchall("SELECT gid,money,num,specid FROM ".tablename('wlmerchant_delivery_order')."WHERE tid = {$ndorder['orderno']} ORDER BY price DESC"); + $va['gname'] = ''; + foreach ($smallorders as $ke => &$orr){ + $goods = pdo_get('wlmerchant_delivery_activity',array('id' => $orr['gid']),array('name','thumb')); + $orr['name'] = $goods['name']; + if($orr['specid']>0){ + $specname = pdo_getcolumn(PDO_NAME.'delivery_spec',array('id'=>$orr['specid']),'name'); + $orr['name'] .= '/'.$specname; + } + $va['gname'] .= '['.$orr['name'].'X'.$orr['num'].']'; + } + } + $va['remark'] = $ndorder['buyremark']; + $va['expressid'] = $ndorder['expressid']; + $va['mobile'] = $ndorder['mobile']; + + $va['remark'] = $ndorder['remark']; + $va['buyremark'] = $ndorder['buyremark']; + + $va['small'] = pdo_getall('wlmerchant_smallorder',array('orderid' => $ndorder['id'],'plugin'=>$ndorder['plugin']),'','','status ASC,hexiaotime ASC'); + $va['neworderflag'] = $ndorder['neworderflag']; + $va['expressprice'] = $ndorder['expressprcie']; + }else{ + $rushorder = pdo_get(PDO_NAME.'rush_order', array('id'=>$va['id'],'uniacid'=>$_W['uniacid']),array('actualprice','expressid','neworderflag','remark','adminremark','usedtime','optionid','checkcode','adminremark','activityid','mobile','address','username')); + $va['plugin'] = '抢购'; + $va['gname'] = pdo_getcolumn(PDO_NAME.'rush_activity',array('id'=>$rushorder['activityid']),'name'); + $va['usedtime'] = $rushorder['usedtime']; + $va['checkcode'] = $rushorder['checkcode']; + if($rushorder['optionid']){ + $va['option'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$rushorder['optionid']),'title'); + } + if($rushorder['expressid']){ + $va['expressid'] = $rushorder['expressid']; + }else{ + $va['peoplename'] = $rushorder['username']; + $va['tel'] = $rushorder['mobile']; + $va['address'] = $rushorder['address']; + $va['mobile'] = $rushorder['mobile']; + } + $va['remark'] = $rushorder['adminremark']; + $va['buyremark'] = $rushorder['remark']; + $va['small'] = pdo_getall('wlmerchant_smallorder',array('orderid' => $va['id'],'plugin'=>'rush'),'','','status ASC,hexiaotime ASC'); + $va['neworderflag'] = $rushorder['neworderflag']; + } + if($va['blendcredit']>0){ + $va['paytype'] = 7; + } + $va['merchantName'] = pdo_getcolumn(PDO_NAME.'merchantdata',array('id'=>$va['sid']),'storename'); + $va['salesmid'] = pdo_getcolumn(PDO_NAME.'merchantdata',array('id'=>$va['sid']),'salesmid'); + $member = pdo_get('wlmerchant_member',array('id' => $va['mid']),array('nickname','realname','mobile')); + $va['nickname'] = $member['nickname']; + if(!empty($member['realname'])){ + $va['nickname'] = $va['nickname']."(".$member['realname'].")"; + } + if(empty($va['mobile'])){ + $va['mobile'] = $member['mobile']; + } + if($va['expressid']){ + if($va['plugin'] == '同城配送'){ + $express = pdo_get('wlmerchant_address',array('id' => $va['expressid']),array('name','tel','province','city','county','detailed_address')); + $va['peoplename'] = $express['name']; + $va['tel'] = $express['tel']; + $va['address'] = $express['province'].$express['city'].$express['county'].$express['detailed_address']; + }else{ + $express = pdo_get('wlmerchant_express',array('id' => $va['expressid']),array('name','tel','expressprice','address','expressname','expresssn')); + $va['peoplename'] = $express['name']; + $va['tel'] = $express['tel']; + $va['address'] = $express['address']; + $va['expressname'] = $express['expressname']; + $va['expresssn'] = $express['expresssn']; + if($va['expressprice'] < 0.01){ + $va['expressprice'] = $express['expressprice']; + } + $va['expressprice'] = sprintf("%.2f",$va['expressprice'] + $va['changedispatchprice']); + } + + } + //分销 + if($va['disorderid']){ + $disorder = pdo_get('wlmerchant_disorder',array('id' => $va['disorderid'])); + $leadmoney = unserialize($disorder['leadmoney']); + $va['onecommission'] = $leadmoney['one']; + $onecom = pdo_get(PDO_NAME.'distributor',array('id'=>$disorder['oneleadid']),array('nickname','mid')); + $va['onecomname'] = $onecom['nickname']; + $va['onecommid'] = $onecom['mid']; + $va['twocommission'] = $leadmoney['two']; + $twocom = pdo_get(PDO_NAME.'distributor',array('id'=>$disorder['twoleadid']),array('nickname','mid')); + $va['twocomname'] = $twocom['nickname']; + $va['twocommid'] = $twocom['mid']; + $va['commission'] = sprintf("%.2f",$va['onecommission']+$va['twocommission']); + } + + $va['orderno'] = "\t".$va['orderno']."\t"; + if($diyformid > 0){ + $va['moinfo'] = unserialize($va['moinfo']); + foreach ($va['moinfo'] as $zzw => $in){ + if($in['id'] == 'checkbox' || $in['id'] == 'img'){ + $va['zzw'.$zzw] = implode(",", $in['data']); + }else if($in['id'] == 'datetime' || $in['id'] == 'city'){ + $va['zzw'.$zzw] = implode("-", $in['data']); + } else{ + $va['zzw'.$zzw] = "\t".$in['data']."\t"; + } + } + } + + } + /* 输出表头 */ + $filter = array( + 'id' => '订单id',//U + 'orderno' => '订单号',//A + 'plugin' => '所属应用',//B + 'gname' => '商品名称',//C + 'option' => '规格名称',//D + 'num' => '数量',//E + 'merchantName' => '所属商家',//F + 'nickname' => '买家昵称',//G + 'mobile' => '买家电话',//H + 'status' => '订单状态',//I + 'paytype' => '支付方式',//J + 'createtime' => '下单时间',//K + 'paytime' => '支付时间',//L + 'price' => '实付金额',//M + 'buyremark' => '买家备注',//N + 'remark' => '卖家备注',//N + 'peoplename' => '收货人姓名',//O + 'tel' => '收货人电话',//P + 'address' => '收货人地址',//Q + 'expressname' => '物流公司',//R + 'expresssn' => '快递单号',//S + 'expressprice' => '快递运费',//S + 'checkcode' => '核销码', + 'hexiaotime' => '核销时间',//T + 'vermember' => '核销员',//U + 'salesmid' => '业务员', + 'commission' => '分销总佣金', + 'onecommission' => '一级分销佣金', + 'onecommid' => '一级分销商MID', + 'onecomname' => '一级分销商昵称', + 'twocommission' => '二级分销佣金', + 'twocommid' => '二级分销商MID', + 'twocomname' => '二级分销商昵称' + ); + + if($diyformid > 0){ + $diyforminfo = pdo_get('wlmerchant_diyform',array('id' => $diyformid),array('info')); + $moinfo = json_decode(base64_decode($diyforminfo['info']) , true); + $list = $moinfo['list']; + $list = array_values($list); + foreach ($list as $wlf => $li){ + $filter['zzw'.$wlf] = $li['data']['title']; + } + } + + $data = array(); + for ($i=0; $i < count($orderlist) ; $i++) { + foreach ($filter as $key => $title) { + $data[$i][$key] = $orderlist[$i]['id']; + if ($key == 'createtime' || $key == 'paytime') { + $data[$i][$key] = date('Y-m-d H:i:s', $orderlist[$i][$key]); + }else if($key == 'status') { + switch ($orderlist[$i][$key]) { + case '1': + $data[$i][$key] = '已支付'; + break; + case '2': + $data[$i][$key] = '已消费'; + break; + case '3': + $data[$i][$key] = '已完成'; + break; + case '4': + $data[$i][$key] = '待收货'; + break; + case '5': + $data[$i][$key] = '已取消'; + break; + case '6': + $data[$i][$key] = '待退款'; + break; + case '7': + $data[$i][$key] = '已退款'; + break; + case '8': + $data[$i][$key] = '待发货'; + break; + case '9': + $data[$i][$key] = '已过期'; + break; + default: + $data[$i][$key] = '未支付'; + break; + } + }else if($key == 'paytype'){ + switch ($orderlist[$i][$key]) { + case '1': + $data[$i][$key] = '余额支付'; + break; + case '2': + $data[$i][$key] = '微信支付'; + break; + case '3': + $data[$i][$key] = '支付宝支付'; + break; + case '4': + $data[$i][$key] = '货到付款'; + break; + case '5': + $data[$i][$key] = '小程序支付'; + break; + case '6': + $data[$i][$key] = '0元购'; + break; + case '7': + $data[$i][$key] = '混合支付'; + break; + default: + $data[$i][$key] = '其他或未支付'; + break; + } + }else if($key == 'checkcode'){ + if($orderlist[$i]['neworderflag']){ + $checkcode = ''; + foreach ($orderlist[$i]['small'] as $kchcek => $sm){ + if($kchcek != 0){ + $checkcode .= '||'.$sm['checkcode']; + }else{ + $checkcode .= $sm['checkcode']; + } + } + $data[$i][$key] = $checkcode; + }else{ + $data[$i][$key] = $orderlist[$i][$key]; + } + + }else if($key == 'hexiaotime'){ + $usedrecord = ''; + if($orderlist[$i]['neworderflag']) { + foreach ($orderlist[$i]['small'] as $ktime => $sm){ + if($ktime != 0){ + if($sm['status'] == 1){ + $usedrecord .=' || 未核销'; + }else if($sm['status'] == 2){ + $usedrecord .=' || '.date('Y-m-d H:i:s',$sm['hexiaotime']); + }else if($sm['status'] == 3){ + $usedrecord .=' || '.date('Y-m-d H:i:s',$sm['refundtime']); + } + }else{ + if($sm['status'] == 1){ + $usedrecord .='未核销'; + }else if($sm['status'] == 2){ + $usedrecord .=date('Y-m-d H:i:s',$sm['hexiaotime']); + }else if($sm['status'] == 3){ + $usedrecord .=date('Y-m-d H:i:s',$sm['refundtime']); + } + } + } + }else{ + $usedtime = unserialize($orderlist[$i]['usedtime']); + if($usedtime){ + foreach ($usedtime as $kK => $used) { + if($kK != 0){ + $usedrecord .= ' || '.date('Y-m-d H:i:s',$used['time']); + }else { + $usedrecord .= date('Y-m-d H:i:s',$used['time']); + } + } + } + } + + $data[$i][$key] = $usedrecord; + }else if($key == 'vermember'){ + $vermembers = ''; + if($orderlist[$i]['neworderflag']) { + foreach ($orderlist[$i]['small'] as $kuid => $sm){ + if($sm['status'] == 1){ + $verm = '未核销'; + }else if($sm['status'] == 2){ + $verm = pdo_getcolumn(PDO_NAME.'merchantuser',array('id'=>$sm['hxuid']),'name'); + }else if($sm['status'] == 3){ + $verm = '已退款'; + } + if($kuid != 0){ + $vermembers .= ' || '.$verm; + }else{ + $vermembers .= $verm; + } + } + }else{ + $usedtime = unserialize($orderlist[$i]['usedtime']); + if($usedtime){ + foreach ($usedtime as $kKs => $user2) { + $user2['vername'] = pdo_getcolumn(PDO_NAME.'merchantuser',array('mid'=>$user2['ver']),'name'); + if($user2['type'] == 3){ + $user2['vername'] = '后台核销'; + }else if($user2['type'] == 4){ + $user2['vername'] = '密码核销'; + } + if($kKs != 0){ + $vermembers .= ' || '.$user2['vername']; + }else { + $vermembers .= $user2['vername']; + } + } + } + } + + $data[$i][$key] = $vermembers; + }else { + $data[$i][$key] = $orderlist[$i][$key]; + } + + } + } + util_csv::export_csv_2($data, $filter, '订单表.csv'); + exit(); + } + + public function orderdetail(){ + global $_W, $_GPC; + $currentid = $_GPC['currentid']; + $orderid = $_GPC['orderid']; + $type = $_GPC['type']; + if($currentid){ + $current = pdo_get('wlmerchant_current',array('id' => $currentid),array('type','orderid')); + $type = $current['type']; + if($type == 140){ + $type = 14; //调整与礼包核销的参数冲突 + } + if($type == 150){ + $type = 15; //调整与支付返现的参数冲突 + } + $orderid = $current['orderid']; + } + + if($type == 1){ + $order = pdo_get('wlmerchant_rush_order',array('id' => $orderid)); + $order['buyremark'] = $order['remark']; + $order['remark'] = $order['adminremark']; + $goodsprice = $order['price']; + $order['ordera'] = 'b'; + if($order['optionid']){ + $order['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$order['optionid']),'title'); + } + if($order['blendcredit'] > 0){ + $order['paytype'] = 7; + $order['blendwx'] = sprintf("%.2f",$order['actualprice'] - $order['blendcredit']); + } + }else if($type == 4){ + $order = pdo_get('wlmerchant_halfcard_record',array('id' => $orderid)); + $goodsprice = $order['price']; + }else{ + $order = pdo_get('wlmerchant_order',array('id' => $orderid)); + $goodsprice = $order['goodsprice']; + $order['ordera'] = 'a'; + if($order['specid'] && $type != 12 && $type != 8){ + if($type == 9){ + $order['optiontitle'] = pdo_getcolumn(PDO_NAME.'activity_spec',array('id'=>$order['specid']),'name'); + }else{ + $order['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$order['specid']),'title'); + } + } + if($order['blendcredit'] > 0){ + $order['paytype'] = 7; + $order['blendwx'] = sprintf("%.2f",$order['price'] - $order['blendcredit']); + } + $order['username'] = $order['name']; + //核销码 + if($order['recordid']){ + if($order['plugin'] == 'groupon'){ + $order['checkcode'] = pdo_getcolumn(PDO_NAME.'groupon_userecord',array('id'=>$order['recordid']),'qrcode'); + }else if($order['plugin'] == 'wlfightgroup'){ + $order['checkcode'] = pdo_getcolumn(PDO_NAME.'fightgroup_userecord',array('id'=>$order['recordid']),'qrcode'); + }else if($order['plugin'] == 'bargain'){ + $order['checkcode'] = pdo_getcolumn(PDO_NAME.'bargain_userlist',array('id'=>$order['recordid']),'qrcode'); + } + } + + } + if(empty($order['transid'])) { + $order['transid'] = pdo_getcolumn(PDO_NAME . 'paylogvfour', array('tid' => $order['orderno']), 'transaction_id'); + } + if(empty($order['transid'])){ + $order['transid'] = pdo_getcolumn(PDO_NAME.'paylog',array('tid'=>$order['orderno']),'transaction_id'); + } + // if($order['transid']){ + // $order['wqorderno'] = pdo_getcolumn('core_paylog',array('uniacid'=>$_W['uniacid'],'tid'=>$order['orderno']),'uniontid'); + // } + + //同步评价表 + switch ($type){ + case '1': + $plugin = 'rush'; + break; + case '2': + $plugin = 'wlfightgroup'; + break; + case '3': + $plugin = 'coupon'; + break; + case '9': + $plugin = 'activity'; + break; + case '10': + $plugin = 'groupon'; + break; + case '11': + $plugin = 'halfcard'; + break; + case '12': + $plugin = 'bargain'; + break; + case '14': + $plugin = 'citydelivery'; + break; + } + $member = pdo_get('wlmerchant_member',array('id' => $order['mid']),array('nickname','mobile','avatar','realname','id','encodename')); + $member['nickname'] = base64_decode($member['encodename']); + $order['avatar'] = $member['avatar']; + switch ($order['status']){ + case '0': + $order['statuscss'] = 'default'; + $order['statustext'] = '未支付'; + break; + case '1': + $order['statuscss'] = 'info'; + $order['statustext'] = '已支付'; + break; + case '2': + $order['statuscss'] = 'success'; + $order['statustext'] = '待评价'; + break; + case '3': + $order['statuscss'] = 'success'; + $order['statustext'] = '已完成'; + break; + case '4': + $order['statuscss'] = 'success'; + $order['statustext'] = '待收货'; + break; + case '5': + $order['statuscss'] = 'defualt'; + $order['statustext'] = '已取消'; + break; + case '6': + $order['statuscss'] = 'warning'; + $order['statustext'] = '待退款'; + break; + case '7': + $order['statuscss'] = 'defualt'; + $order['statustext'] = '已退款'; + break; + case '8': + $order['statuscss'] = 'info'; + $order['statustext'] = '待发货'; + break; + case '9': + $order['statuscss'] = 'danger'; + $order['statustext'] = '已过期'; + break; + default: + $order['statuscss'] = 'danger'; + $order['statustext'] = '错误状态'; + break; + } + + switch ($order['paytype']){ + case '1': + $order['paytypecss'] = 'info'; + $order['paytypetext'] = '余额支付'; + break; + case '2': + $order['paytypecss'] = 'success'; + $order['paytypetext'] = '微信支付'; + break; + case '3': + $order['paytypecss'] = 'danger'; + $order['paytypetext'] = '支付宝'; + break; + case '4': + $order['paytypecss'] = 'warning'; + $order['paytypetext'] = '货到付款'; + break; + case '5': + $order['paytypecss'] = 'warning'; + $order['paytypetext'] = '小程序支付'; + break; + case '6': + $order['paytypecss'] = 'danger'; + $order['paytypetext'] = '0元购'; + break; + case '7': + $order['paytypecss'] = 'danger'; + $order['paytypetext'] = '混合支付'; + break; + default: + $order['paytypecss'] = 'default'; + $order['paytypetext'] = '未知方式'; + break; + } + //额外信息 + if(!empty($order['moinfo'])){ + $moinfo = unserialize($order['moinfo']); + + } + //订单日志 + $logs = array(); + $logs[] = array( //下单 + 'time' => $order['createtime'], + 'title' => '订单提交成功', + 'detail' => '单号:'.$order['orderno'].',等待买家付款' + ); + //抢购核销 + if($type == 1){ + $usedtime = unserialize($order['usedtime']); + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '支付成功,等待买家前往商户核销订单或商家发货' + ); + } + + if($order['expressid']){ + $express = pdo_get('wlmerchant_express',array('id' => $order['expressid']),array('expressname','expresssn','expressprice','sendtime','receivetime')); + $expressprice = $express['expressprice']; + if($express['sendtime']){ + $logs[] = array( //支付 + 'time' => $express['sendtime'], + 'title' => '商品已发货', + 'detail' => '快递公司:'.$express['expressname'].',快递单号:'.$express['expresssn'].',等待买家收货' + ); + } + if($express['receivetime']){ + $logs[] = array( //支付 + 'time' => $express['receivetime'], + 'title' => '商品已签收', + 'detail' => '用户已签收商品,等待系统结算订单' + ); + } + } + + + } + //拼团 + if($type == 2){ + //组团 + if($order['fightstatus'] == 1){ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '支付成功,等待组团成功' + ); + } + + + $group = pdo_get('wlmerchant_fightgroup_group',array('id' => $order['fightgroupid'])); + if($group['status'] == 2){ + $logs[] = array( //支付 + 'time' => $group['successtime'], + 'title' => '组团成功', + 'detail' => '拼团组团成功,等待买家前往商户核销订单或商家发货' + ); + }else if($group['status'] == 3){ + $logs[] = array( //支付 + 'time' => $group['failtime'], + 'title' => '组团失败', + 'detail' => '拼团组团失败,即将给买家退款' + ); + } + }else{ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '支付成功,等待买家前往商户核销订单或商家发货' + ); + } + } + + if($order['recordid']){ //核销 + $record = pdo_get('wlmerchant_fightgroup_userecord',array('id' => $order['recordid']),array('usedtime')); + $usedtime = unserialize($record['usedtime']); + }else if($order['expressid']){ + $express = pdo_get('wlmerchant_express',array('id' => $order['expressid']),array('expressname','expresssn','expressprice','sendtime','receivetime')); + $expressprice = $express['expressprice']; + if($express['sendtime']){ + $logs[] = array( //支付 + 'time' => $express['sendtime'], + 'title' => '商品已发货', + 'detail' => '快递公司:'.$express['expressname'].',快递单号:'.$express['expresssn'].',等待买家收货' + ); + } + if($express['receivetime']){ + $logs[] = array( //支付 + 'time' => $express['receivetime'], + 'title' => '商品已签收', + 'detail' => '用户已签收商品,等待系统结算订单' + ); + } + + } + } + + //超级券 + if($type == 3){ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '支付成功,等待买家前往商户核销订单' + ); + } + //核销 + $usedtime = pdo_getcolumn(PDO_NAME.'member_coupons',array('id'=>$order['recordid']),'usedtime'); + $usedtime = unserialize($usedtime); + } + //一卡通 + if($type == 4){ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '支付成功,买家已成功开通会员,等待系统结算' + ); + } + } + //付费发帖 + if($type == 5){ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '支付成功,帖子已发布,等待系统结算' + ); + } + } + //付费发帖 + if($type == 6){ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '支付成功,商家已入住,等待审核,订单等待系统结算' + ); + } + } + //付费成为分销商 + if($type == 8){ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '支付成功,分销商申请成功,等待审核,订单等待系统结算' + ); + } + } + //活动 + if($type == 9){ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '支付成功,等待买家在活动期间前往指定地点参加活动' + ); + } + } + + //团购 + if($type == 10){ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '支付成功,等待买家前往商户核销订单' + ); + } + + if($order['expressid']){ + $express = pdo_get('wlmerchant_express',array('id' => $order['expressid']),array('expressname','expresssn','expressprice','sendtime','receivetime')); + $expressprice = $express['expressprice']; + if($express['sendtime']){ + $logs[] = array( //支付 + 'time' => $express['sendtime'], + 'title' => '商品已发货', + 'detail' => '快递公司:'.$express['expressname'].',快递单号:'.$express['expresssn'].',等待买家收货' + ); + } + if($express['receivetime']){ + $logs[] = array( //支付 + 'time' => $express['receivetime'], + 'title' => '商品已签收', + 'detail' => '用户已签收商品,等待系统结算订单' + ); + } + }else{ + //核销 + $usedtime = pdo_getcolumn(PDO_NAME.'groupon_userecord',array('id'=>$order['recordid']),'usedtime'); + $usedtime = unserialize($usedtime); + } + } + + //在线买单 + if($type == 11){ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '在线买单支付成功,订单等待系统结算' + ); + } + } + + //砍价订单 + if($type == 12){ + if($order['expressid']){ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '订单支付成功,等待商家发货' + ); + } + $express = pdo_get('wlmerchant_express',array('id' => $order['expressid']),array('expressname','expresssn','expressprice','sendtime','receivetime')); + $expressprice = $express['expressprice']; + if($express['sendtime']){ + $logs[] = array( //支付 + 'time' => $express['sendtime'], + 'title' => '商品已发货', + 'detail' => '快递公司:'.$express['expressname'].',快递单号:'.$express['expresssn'].',等待买家收货' + ); + } + if($express['receivetime']){ + $logs[] = array( //支付 + 'time' => $express['receivetime'], + 'title' => '商品已签收', + 'detail' => '用户已签收商品,等待系统结算订单' + ); + } + }else{ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '订单支付成功,等待买家到店核销' + ); + } + $record = pdo_get('wlmerchant_bargain_userlist',array('id' => $order['specid']),array('usedtime')); + $usedtime = unserialize($record['usedtime']); + } + } + //同城配送 + if($type == 14){ + if($order['paytime']){ + if($order['expressid']){ + $deliveryremark1 = '支付成功,等待商家配送'; + $expressprice = $order['expressprcie']; + }else{ + $deliveryremark1 = '支付成功,等待买家前往商户自提'; + } + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => $deliveryremark1 + ); + } + + if($order['status'] == 2 || $order['status'] == 3 ){ + if($order['deliverytype'] == 1){ + $deliveryremark2 = '用户确认订单完成'; + }else if($order['deliverytype'] == 2){ + $deliveryremark2 = '商户确认订单完成'; + }else{ + $deliveryremark2 = '平台确认订单完成'; + } + $logs[] = array( //完成 + 'time' => pdo_getcolumn(PDO_NAME.'delivery_order',array('tid'=>$order['orderno']),'dotime'), + 'title' => '订单已完成', + 'detail' => $deliveryremark2 + ); + } + + } + + //黄页114 求职招聘 + if($type == 15 || $type == 16){ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '支付成功,订单等待系统结算' + ); + } + } + //权益 + if($type == 20){ + if($order['paytime']){ + $logs[] = array( //支付 + 'time' => $order['paytime'], + 'title' => '订单支付成功', + 'detail' => '支付成功,订单等待系统结算' + ); + } + } + + if($usedtime){ + foreach ($usedtime as $key => $used) { + switch ($used['type']){ + case '1': + $used['typename'] = '输码核销'; + break; + case '2': + $used['typename'] = '扫码核销'; + break; + case '3': + $used['typename'] = '后台核销'; + break; + case '4': + $used['typename'] = '密码核销'; + break; + default: + $used['typename'] = '未知方式'; + break; + } + if($used['type'] == 1 || $used['type'] == 2){ + $used['vername'] = pdo_getcolumn(PDO_NAME.'merchantuser',array('mid'=>$used['ver'],'storeid'=>$order['sid']),'name'); + }else { + $used['vername'] = '无'; + } + $kk = $key+1; + $logs[] = array( + 'time' => $used['time'], + 'title' => '第'.$kk.'次核销', + 'detail' => '核销方式:'.$used['typename'].',核销员:'.$used['vername'].'。' + ); + if(empty($order['usetimes']) && $kk == count($usedtime)){ + $logs[] = array( + 'time' => $used['time'], + 'title' => '核销完成', + 'detail' => '订单已全部核销,等待系统结算订单' + ); + } + } + } + + if($order['neworderflag']){ + $hexiaotype = array(1=>'输码核销',2=>'扫码核销',3=>'后台核销','4'=>'密码核销','5'=>'系统自动核销'); + $smallorders = pdo_getall('wlmerchant_smallorder',array('orderid' => $order['id'],'plugin'=>$plugin)); + foreach ($smallorders as $key => &$smallasd){ + if($smallasd['status'] == 2){ + $smalltype = $smallasd['hexiaotype']; + if($smallasd['hxuid']){ + $vername = pdo_getcolumn(PDO_NAME.'merchantuser',array('id'=>$smallasd['hxuid']),'name'); + }else{ + $vername = '无'; + } + $logs[] = array( + 'time' => $smallasd['hexiaotime'], + 'title' => '核销码:'.$smallasd['checkcode'], + 'detail' => '核销方式:'.$hexiaotype[$smalltype].',核销员:'.$vername.'。' + ); + $smallasd['douser'] = $hexiaotype[$smalltype].':'.$vername; + $smallasd['dotime'] = date('Y-m-d H:i:s',$smallasd['hexiaotime']); + }else if($smallasd['status'] == 3){ + $logs[] = array( + 'time' => $smallasd['refundtime'], + 'title' => '核销码['.$smallasd['checkcode'].']已退款', + 'detail' => '' + ); + $smallasd['douser'] = '订单退款'; + $smallasd['dotime'] = date('Y-m-d H:i:s',$smallasd['refundtime']); + }else{ + $smallasd['douser'] = '无'; + $smallasd['dotime'] = '未操作'; + } + } + } + //退款 + if($order['status'] == 7){ + $logs[] = array( + 'time' => $order['refundtime'], + 'title' => '订单已退款', + 'detail' => '订单已退款,此订单已结束' + ); + } + //过期 + if($order['status'] == 9){ + $logs[] = array( + 'time' => $order['overtime'], + 'title' => '订单已过期', + 'detail' => '订单已过期,等待系统结算订单' + ); + } + //结算 + if($order['issettlement'] == 1){ + $settlement = pdo_fetch("SELECT * FROM ".tablename('wlmerchant_autosettlement_record')."WHERE orderid = {$order['id']} AND type = {$type} ORDER BY id DESC"); + $logs[] = array( + 'time' => $settlement['createtime'], + 'title' => '订单已结算', + 'detail' => '订单已结算,此订单已完成' + ); + } + //售后 + $afters = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_aftersale')."WHERE uniacid = {$_W['uniacid']} AND orderno = {$order['orderno']} ORDER BY createtime ASC"); + if($afters){ + foreach ($afters as &$af){ + $journal = unserialize($af['journal']); + foreach ($journal as $jo){ + $jo = unserialize($jo); + $jo['thumbs'] = unserialize($jo['thumbs']); + if(!empty($jo['thumbs'])){ + $jo['thumbs'] = explode(',',$jo['thumbs']); + } + $logs[] = $jo; + } + $af['checkcodes'] = unserialize($af['checkcodes']); + $af['thumbs'] = unserialize($af['thumbs']); + if(!empty($af['thumbs'])){ + $af['thumbs'] = explode(',',$af['thumbs']); + } + if($order['ordera'] == 'a'){ + $refunda = 'b'; + }else{ + $refunda = 'a'; + } + $af['refundurl'] = web_url('order/wlOrder/refund',array('id'=>$af['orderid'],'afterid'=>$af['id'],'type'=>$refunda)); + } + } + //评价 + if($order['status'] == 3){ + $commenttime = pdo_getcolumn(PDO_NAME.'comment',array('plugin'=>$plugin,'idoforder'=>$order['id']),'createtime'); + if($commenttime){ + $logs[] = array( + 'time' => $commenttime, + 'title' => '订单已评价', + 'detail' => '用户就此订单对商户发表了评价' + ); + } + } + $flag = array(); + foreach($logs as $v){ + $flag[] = $v['time']; + } + array_multisort($flag, SORT_ASC, $logs); + //价格明细 + if($type == 1){ //抢购 + //商品价格 + $goods = pdo_get('wlmerchant_rush_activity',array('id' => $order['activityid']),array('id','price','aid','vipprice','name','thumb')); + if($order['optionid']){ + $option = pdo_get('wlmerchant_goods_option',array('id' => $order['optionid']),array('price','vipprice')); + $goods['price'] = $option['price']; + $goods['vipprice'] = $option['vipprice']; + } + if ($order['vipbuyflag']) { + if($order['discount'] > 0){ + $vipdiscount = $order['discount']; + }else { + if ($order['optionid']) { + $vipdiscount = sprintf("%.2f", $option['price'] - $option['vipprice']); + } else { + $vipdiscount = sprintf("%.2f", $goods['price'] - $goods['vipprice']); + } + } + } + //积分抵扣 + $dkcredit = $order['dkcredit']; + $dkmoney = $order['dkmoney']; + $actualprice = $order['actualprice']; + if(is_store()){ + $editurl = "./citystore.php?uniacid={$_W['uniacid']}&aid={$goods['aid']}&p=goodshouse&ac=goodshouse&do=createactive&id={$goods['id']}&plugin=rush"; + }else if(empty($goods['aid'])){ + $editurl = web_url('goodshouse/goodshouse/createactive',array('id'=>$goods['id'],'plugin'=>'rush')); + }else { + $editurl = "./cityagent.php?uniacid={$_W['uniacid']}&aid={$goods['aid']}&p=goodshouse&ac=goodshouse&do=createactive&id={$goods['id']}&plugin=rush"; + } + }else if($type == 2){ //拼团 + $goods = pdo_get('wlmerchant_fightgroup_goods',array('id' => $order['fkid']),array('id','price','aid','aloneprice','vipdiscount','name','logo')); + //会员减免 + if($order['vipbuyflag']){ + if($order['vipdiscount'] > 0){ + $vipdiscount = $order['vipdiscount']; + }else { + $vipdiscount = sprintf("%.2f", $goods['vipdiscount'] * $order['num']); + } + } + //积分抵扣 + $dkcredit = $order['usecredit']; + $dkmoney = $order['cerditmoney']; + + $goods['thumb'] = $goods['logo']; + $actualprice = $order['price']; + if(is_store()){ + $editurl = "./citystore.php?uniacid={$_W['uniacid']}&aid={$goods['aid']}&p=goodshouse&ac=goodshouse&do=createactive&id={$goods['id']}&plugin=fightgroup"; + }else if(empty($goods['aid'])){ + $editurl = web_url('goodshouse/goodshouse/createactive',array('id'=>$goods['id'],'plugin'=>'fightgroup')); + }else{ + $editurl = "./cityagent.php?uniacid={$_W['uniacid']}&aid={$goods['aid']}&p=goodshouse&ac=goodshouse&do=createactive&id={$goods['id']}&plugin=fightgroup"; + } + }else if($type == 3){ + $goods = pdo_get('wlmerchant_couponlist',array('id' => $order['fkid']),array('id','price','aid','vipprice','title','logo')); + $goods['name'] = $goods['title']; + $goods['thumb'] = $goods['logo']; + $actualprice = $order['price']; + if ($order['vipbuyflag']) { + if($order['vipdiscount'] > 0){ + $vipdiscount = $order['vipdiscount']; + }else { + $vipdiscount = sprintf("%.2f", $goods['price'] - $goods['vipprice']); + } + } + //积分抵扣 + $dkcredit = $order['usecredit']; + $dkmoney = $order['cerditmoney']; + if(is_store()){ + $editurl = "./citystore.php?uniacid={$_W['uniacid']}&aid={$goods['aid']}&p=wlcoupon&ac=couponlist&do=editCoupons&id={$goods['id']}"; + }else if(empty($goods['aid'])){ + $editurl = web_url('wlcoupon/couponlist/editCoupons',array('id'=>$goods['id'])); + }else{ + $editurl = "./cityagent.php?uniacid={$_W['uniacid']}&aid={$goods['aid']}&p=wlcoupon&ac=couponlist&do=editCoupons&id={$goods['id']}"; + } + }else if($type == 9){ + $goods = pdo_get('wlmerchant_activitylist',array('id' => $order['fkid']),array('id','aid','price','vipprice','title','thumb')); + $goods['name'] = $goods['title']; + if ($order['vipbuyflag']) { + if($order['vipdiscount'] > 0){ + $vipdiscount = $order['vipdiscount']; + }else { + $vipdiscount = $goods['vipprice']; + } + } + $actualprice = $order['price']; + //积分抵扣 + $dkcredit = $order['usecredit']; + $dkmoney = $order['cerditmoney']; + if(is_store()){ + $editurl = "./citystore.php?uniacid={$_W['uniacid']}&aid={$goods['aid']}&p=activity&ac=activity_web&do=createactivity&id={$goods['id']}"; + }else if(empty($goods['aid'])){ + $editurl = web_url('activity/activity_web/createactivity',array('id'=>$goods['id'])); + }else{ + $editurl = "./cityagent.php?uniacid={$_W['uniacid']}&aid={$goods['aid']}&p=activity&ac=activity_web&do=createactivity&id={$goods['id']}"; + } + }else if($type == 10){ + $goods = pdo_get('wlmerchant_groupon_activity',array('id' => $order['fkid']),array('id','aid','price','vipprice','name','thumb')); + if ($order['vipbuyflag']) { + if($order['vipdiscount'] > 0){ + $vipdiscount = $order['vipdiscount']; + }else { + if ($order['specid']) { + $option = pdo_get('wlmerchant_goods_option', array('id' => $order['specid']), array('price', 'vipprice')); + $vipdiscount = sprintf("%.2f", $option['price'] - $option['vipprice']); + } else { + $vipdiscount = sprintf("%.2f", $goods['price'] - $goods['vipprice']); + } + } + } + $actualprice = $order['price']; + //积分抵扣 + $dkcredit = $order['usecredit']; + $dkmoney = $order['cerditmoney']; + if(is_store()){ + $editurl = "./citystore.php?uniacid={$_W['uniacid']}&aid={$goods['aid']}&p=goodshouse&ac=goodshouse&do=createactive&id={$goods['id']}&plugin=groupon"; + }else if(empty($goods['aid'])){ + $editurl = web_url('goodshouse/goodshouse/createactive',array('id'=>$goods['id'],'plugin'=>'groupon')); + }else{ + $editurl = "./cityagent.php?uniacid={$_W['uniacid']}&aid={$goods['aid']}&p=goodshouse&ac=goodshouse&do=createactive&id={$goods['id']}&plugin=groupon"; + } + }else if($type == 4){ + $goods = pdo_get('wlmerchant_halfcard_type',array('id' => $order['typeid']),array('id','price','name','logo')); + $order['num'] = 1; + $goods['thumb'] = $goods['logo']; + $actualprice = $order['price']; + $editurl = web_url('halfcard/halftype/add',array('id'=>$goods['id'])); + }else if($type == 5){ + $informations = pdo_get('wlmerchant_pocket_informations',array('id' => $order['fkid']),array('type')); + $goods = pdo_get('wlmerchant_pocket_type',array('id' => $informations['type']),array('title','price','img')); + $goods['thumb'] = $goods['img']; + $goods['name'] = '发布'.$goods['title'].'信息'; + $actualprice = $order['price']; + $editurl = web_url('pocket/Type/operating',array('eid'=>$goods['id'])); + }else if($type == 6){ + $goods = pdo_get('wlmerchant_chargelist',array('id' => $order['fkid']),array('id','price','name')); + $goods['thumb'] = URL_MODULE.'web/resource/image/store.png'; + $goods['name'] = '付费入驻:'.$goods['name']; + $actualprice = $order['price']; + $order['num'] = 1; + $editurl = web_url('setting/register/add',array('id'=>$goods['id'])); + }else if($type == 8){ + $goods['thumb'] = URL_MODULE.'web/resource/image/store.png'; + $goods['name'] = '付费申请成为分销商'; + $actualprice = $order['price']; + $order['num'] = 1; + $editurl = web_url('distribution/dissysbase/disbaseset'); + }else if($type == 11){ + $goods['thumb'] = pdo_getcolumn(PDO_NAME.'merchantdata',array('uniacid'=>$_W['uniacid'],'id'=>$order['sid']),'logo'); + $goods['thumb'] = tomedia($goods['thumb']); + $actualprice = $order['price']; + //积分抵扣 + $dkcredit = $order['usecredit']; + $dkmoney = $order['cerditmoney']; + $order['num'] = 1; + if($order['fkid']){ + $goods['name'] = pdo_getcolumn(PDO_NAME.'halfcardlist',array('uniacid'=>$_W['uniacid'],'id'=>$order['fkid']),'title'); + $editurl = web_url('halfcard/halfcard_web/editHalfcard',array('id'=>$order['fkid'])); + }else{ + $goods['name'] = '买家在线买单'; + } + $vipdiscount = $order['card_fee']; + }else if($type == 12){ + $actualprice = $order['price']; + $goods = pdo_get(PDO_NAME.'bargain_activity',array('uniacid'=>$_W['uniacid'],'id'=>$order['fkid']),array('id','thumb','name')); + $goods['thumb'] = tomedia($goods['thumb']); + //积分抵扣 + $dkcredit = $order['usecredit']; + $dkmoney = $order['cerditmoney']; + if(is_store()){ + $editurl = "./citystore.php?uniacid={$_W['uniacid']}&aid={$goods['aid']}&p=goodshouse&ac=goodshouse&do=createactive&id={$goods['id']}&plugin=bargain"; + }else if(empty($goods['aid'])){ + $editurl = web_url('goodshouse/goodshouse/createactive',array('id'=>$goods['id'],'plugin'=>'bargain')); + }else{ + $editurl = "./cityagent.php?uniacid={$_W['uniacid']}&aid={$goods['aid']}&p=goodshouse&ac=goodshouse&do=createactive&id={$goods['id']}&plugin=bargain"; + } + }else if($type == 13){ + $actualprice = $order['price']; + if($order['fightstatus'] == 1){ + $goods = pdo_get(PDO_NAME.'citycard_meals',array('uniacid'=>$_W['uniacid'],'id'=>$order['fkid']),array('name')); + }else{ + $goods = pdo_get(PDO_NAME.'citycard_tops',array('uniacid'=>$_W['uniacid'],'id'=>$order['fkid']),array('name')); + } + }else if($type == 14){ //同城配送 + //商品价格 + $delivery_orders = pdo_getall('wlmerchant_delivery_order',array('tid' => $order['orderno']),array('gid','num','price','aid','specid')); + foreach ($delivery_orders as &$delivery_or){ + $delivery_or['good'] = pdo_get('wlmerchant_delivery_activity',array('id' => $delivery_or['gid']),array('name','thumb')); + $delivery_or['good']['thumb'] = tomedia($delivery_or['good']['thumb']); + if($delivery_or['specid']){ + $delivery_or['good']['specname'] = pdo_getcolumn(PDO_NAME.'delivery_spec',array('id'=>$delivery_or['specid']),'name'); + } + if(is_store()){ + $delivery_or['good']['editurl'] = "./citystore.php?uniacid={$_W['uniacid']}&aid={$delivery_or['aid']}&p=citydelivery&ac=active&do=createactive&id={$delivery_or['gid']}"; + }else if(empty($delivery_or['aid'])){ + $delivery_or['good']['editurl'] = web_url('citydelivery/active/createactive',array('id'=>$delivery_or['gid'])); + }else { + $delivery_or['good']['editurl'] = "./cityagent.php?uniacid={$_W['uniacid']}&aid={$delivery_or['aid']}&p=citydelivery&ac=active&do=createactive&id={$delivery_or['gid']}"; + } + } + //积分抵扣 + $dkcredit = $order['usecredit']; + $dkmoney = $order['cerditmoney']; + $vipdiscount = $order['vipdiscount']; + $actualprice = $order['price']; + }else if($type == 15){ + $yellow = pdo_get('wlmerchant_yellowpage_lists' , ['id' => $order['fkid']],['name','logo']); + switch ($order['fightstatus']) { + case '1': + $goods['name'] = '页面['.$yellow['name'].']认领'; + break; + case '2': + $goods['name'] = '页面['.$yellow['name'].']查阅'; + break; + case '3': + $meal = pdo_get('wlmerchant_yellowpage_meals' , ['id' => $order['specid']],['name']); + $goods['name'] = '页面['.$yellow['name'].']入驻['.$meal['name'].']'; + break; + case '4': + $meal = pdo_get('wlmerchant_yellowpage_meals' , ['id' => $order['specid']],['name']); + $goods['name'] = '页面['.$yellow['name'].']续费['.$meal['name'].']'; + break; + } + $goods['thumb'] = tomedia($yellow['logo']); + }else if($type == 16){ + $recruit = pdo_get('wlmerchant_recruit_recruit' , ['id' => $order['fkid']],['title']); + if($order['fightstatus'] == 1){ + $goods['name'] = '发布['.$recruit['title'].']岗位'; + }else if($order['fightstatus'] == 2){ + $goods['name'] = '置顶['.$recruit['title'].']岗位'; + } + }else if($type == 20){ + $rightsInfo = Rights::getRightsInfo($order['payfor'],$order['fkid']); + $goods['name'] = $rightsInfo['name']; + } + if(empty($actualprice)){ + $actualprice = $order['price']; + } + + $fullreducemoney = $order['fullreducemoney']; + $redpackmoney = $order['redpackmoney']; + if($redpackmoney > 0){ + $packid = pdo_getcolumn(PDO_NAME.'redpack_records',array('id'=>$order['redpackid']),'packid'); + $packname = pdo_getcolumn(PDO_NAME.'redpacks',array('id'=>$packid),'title'); + } + + //同时开通一卡通 + if($order['vip_card_id'] > 0){ + $vipCardPrice = pdo_getcolumn(PDO_NAME.'halfcard_type',array('id'=>$order['vip_card_id']),'price'); + } + //结算金额 + if($order['issettlement'] == 1){ + $salesmoney = 0; + $hexiaoprice = 0; + if($order['neworderflag']){ + $merchantmoney = 0; + $agentmoney = 0; + $distrimoney = 0; + $refundmoney = 0; + $num = 0; + foreach ($smallorders as $key => $small){ + if($small['status'] == 2){ + $orderset = pdo_fetch("SELECT * FROM ".tablename('wlmerchant_autosettlement_record')."WHERE orderid = {$order['id']} AND type = {$type} AND checkcode = '{$small['checkcode']}'"); + $merchantmoney += $orderset['merchantmoney']; + $agentmoney += $orderset['agentmoney']; + $distrimoney += $orderset['distrimoney']; + $num += 1; + } + $hexiaoprice = $goodsprice / $order['num'] * $num; + } + }else{ + $agentmoney = $settlement['agentmoney']; //代理金额 + $merchantmoney = $settlement['merchantmoney']; //商户金额 + $distrimoney = $settlement['distrimoney']; //分销金额 + $hexiaoprice = $goodsprice; //计算业务员金额的基础数据 + } + if($distrimoney > 0){ + $disorder = pdo_get('wlmerchant_disorder',array('id' => $order['disorderid']),array('oneleadid','twoleadid','leadmoney')); + $onename = pdo_getcolumn(PDO_NAME.'distributor',array('id'=>$disorder['oneleadid']),'nickname'); + $twoname = pdo_getcolumn(PDO_NAME.'distributor',array('id'=>$disorder['twoleadid']),'nickname'); + $leadmoney = unserialize($disorder['leadmoney']); + } + //计算业务员佣金 + if(!empty($order['salesarray'])){ + $salesarray = unserialize($order['salesarray']); + foreach ($salesarray as &$sale){ + $sale['salemoney'] = sprintf("%.2f",$hexiaoprice * $sale['scale'] / 100 ); + $sale['nickname'] = pdo_getcolumn(PDO_NAME.'member',array('id'=>$sale['mid']),'nickname'); + $salesmoney += $sale['salemoney']; + } + } + + if($order['shareid']){ + $shares = pdo_get('wlmerchant_sharegift_record',array('id' => $order['shareid']),array('price','type','mid')); + $sharemoney = sprintf("%.2f",$shares['price']*$order['num']); + if($shares['type'] == 2){ + $sharename = pdo_getcolumn(PDO_NAME.'member',array('id'=>$shares['mid']),'nickname'); + } + } + } + + $refundmoney = pdo_getcolumn('wlmerchant_refund_record',array('plugin' => $plugin,'orderid'=>$orderid,'status'=>1),array("SUM(refundfee)")); + if($order['status'] == 7 && $order['neworderflag']){ + $merchantmoney = 0.00; + } + + //快递栏 + if($order['expressid']){ + if($order['plugin'] == 'citydelivery'){ + if($order['fightgroupid'] > 0){ + $express = pdo_get('wlmerchant_express',array('id' => $order['fightgroupid'])); + }else{ + $addressinfo = pdo_get('wlmerchant_address',array('id' => $order['expressid'])); + $express['address'] = $addressinfo['province'].$addressinfo['city'].$addressinfo['county'].$addressinfo['detailed_address']; + $express['name'] = $addressinfo['name']; + $express['tel'] = $addressinfo['tel']; + } + }else{ + $express = pdo_get('wlmerchant_express',array('id' => $order['expressid'])); + } + + } + + include wl_template('finace/newcashorder'); + } + + //驳回申请 + function delerefund(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $type = $_GPC['type']; + if($type == 'a'){ + $res = pdo_update('wlmerchant_order',array('applyrefund' => 0),array('id' => $id)); + }else{ + $res = pdo_update('wlmerchant_rush_order',array('applyrefund' => 0),array('id' => $id)); + } + if($res){ + show_json(1); + }else{ + show_json(0,'驳回失败,请重试'); + } + } + //发货 + function send(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $type = $_GPC['type']; + $settings = Setting::wlsetting_read('orderset'); + $edit_flag = $_GPC['edit_flag']; + if($type == 'a'){ + $orderInfo = pdo_fetch("SELECT a.expressid,a.plugin,a.orderno,a.mid, + CASE a.`plugin` + WHEN 'consumption' THEN (SELECT `title` FROM ".tablename(PDO_NAME.'consumption_goods')." WHERE `id` = a.`fkid`) + WHEN 'bargain' THEN (SELECT `name` FROM ".tablename(PDO_NAME.'bargain_activity')." WHERE `id` = a.`fkid` ) + WHEN 'groupon' THEN (SELECT `name` FROM ".tablename(PDO_NAME.'groupon_activity')." WHERE `id` = a.`fkid` ) + WHEN 'wlfightgroup' THEN (SELECT name FROM ".tablename(PDO_NAME.'fightgroup_goods')." WHERE `id` = a.`fkid`) + END as name FROM ".tablename(PDO_NAME.'order')." as a WHERE a.id = {$id} "); + }else{ + $orderInfo = pdo_fetch("SELECT a.expressid,b.name,'rush' as plugin,a.orderno,a.mid FROM ".tablename(PDO_NAME."rush_order") ." as a LEFT JOIN " + .tablename(PDO_NAME."rush_activity") ." as b ON a.activityid = b.id WHERE a.id = {$id} "); + } + $expressid = $orderInfo['expressid']; + if(empty($expressid)){ + show_json(0, '无收货地址,无法发货!'); + } + $express = pdo_get(PDO_NAME.'express',array('id' => $expressid)); + if ($_W['ispost']){ + if (empty($_GPC['expresssn']) && !empty($_GPC['express'])){ + show_json(0, '请输入快递单号!'); + } + $expressname = $_GPC['express']; + $expresssn = $_GPC['expresssn']; + $res = pdo_update('wlmerchant_express', array('expressname' => $expressname,'expresssn'=>$expresssn,'orderid'=>$id,'sendtime'=>time()), array('id' => $expressid)); + if($res){ + if($type == 'a'){ + $res = pdo_update('wlmerchant_order', array('status' => 4), array('id' => $id)); + if($orderInfo['plugin'] == 'consumption'){ + pdo_update(PDO_NAME."consumption_record", ['status'=>2], ['orderid'=>$id]); + } + if($settings['receipt']>0){ + if($edit_flag){ + pdo_delete('wlmerchant_waittask',array('important'=>$id,'key'=>6,'status'=>0)); + } + $receipttime = time() + $settings['receipt']*24*3600; + $task = array( + 'type' => 'order', + 'orderid' => $id + ); + $task = serialize($task); + Queue::addTask(6, $task,$receipttime, $id); + } + }else{ + $res = pdo_update('wlmerchant_rush_order', array('status' => 4), array('id' => $id)); + if($settings['receipt']>0){ + if($edit_flag){ + pdo_delete('wlmerchant_waittask',array('important'=>$id,'key'=>6,'status'=>0)); + } + $receipttime = time() + $settings['receipt']*24*3600; + $task = array( + 'type' => 'rush', + 'orderid' => $id + ); + $task = serialize($task); + Queue::addTask(6, $task,$receipttime, $id); + } + } + /***模板通知***/ + $url = h5_url('pages/subPages/orderList/orderDetails/orderDetails',['orderid'=>$id,'plugin'=>$orderInfo['plugin']]); + $modelData = [ + 'first' => '您购买的商品已发货,请注意查收!' , + 'order_no' => $orderInfo['orderno'] ,//订单编号 + 'express_name' => $expressname,//物流公司 + 'express_no' => $expresssn ,//物流单号 + 'goods_name' => $orderInfo['name'] ,//商品信息 + 'consignee' => $express['name'] ,//收货人 + 'receiving_address' => $express['address'] ,//收货地址 + 'remark' => '点击查看物流详细信息!' + ]; + //渠道信息获取 + $source = pdo_getcolumn(PDO_NAME."paylogvfour",['tid'=>$orderInfo['orderno']],'source'); + $res = TempModel::sendInit('send',$orderInfo['mid'],$modelData,$source,$url); + /***模板通知***/ + show_json(1); + }else{ + show_json(0,'发货失败请重试'); + } + } + //快递 + $express_list = Logistics::codeComparisonTable('',0,true); + + + include wl_template('order/send'); + } + //改价 + function changeprice(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $type = $_GPC['type']; + if($type == 'a'){ + $order = pdo_get('wlmerchant_order',array('id' => $id),array('expressid','price','originalprice','changeprice','changedispatchprice')); + if($order['originalprice']>0){ + $price = $order['originalprice']; + }else{ + $price = $order['price']; + } + }else{ + $order = pdo_get('wlmerchant_rush_order',array('id' => $id),array('expressid','price','actualprice','originalprice','changeprice','changedispatchprice')); + if($order['originalprice']>0){ + $price = $order['originalprice']; + }else{ + $price = $order['actualprice']; + } + } + if ($_W['ispost']){ + $price_type = $_GPC['price_type']; + $price_value = trim($_GPC['price_value']); + $price_value = sprintf("%.2f",$price_value); + $express_type = $_GPC['express_type']; + $express_value = $_GPC['express_value']; + $express_value = sprintf("%.2f",$express_value); + if($price_type == 2){ + $price_value = -$price_value; + } + if($express_type == 2){ + $express_value = -$express_value; + } + $newprice = $price + $price_value + $express_value; + if($newprice<0 ||$newprice == 0 ){ + show_json(0,'改价失败,改价后订单金额不能小于或等于0'); + } + if($type == 'a'){ + $res = pdo_update('wlmerchant_order',array('price' => $newprice,'changeprice' => $price_value,'changedispatchprice'=>$express_value,'originalprice'=>$price,'orderno'=>createUniontid()),array('id' => $id)); + }else{ + $res = pdo_update('wlmerchant_rush_order',array('actualprice' => $newprice,'changeprice' => $price_value,'changedispatchprice'=>$express_value,'originalprice'=>$price,'orderno'=>createUniontid()),array('id' => $id)); + } + if($res){ + show_json(1); + }else{ + show_json(0,'改价失败,请重试'); + } + } + include wl_template('order/changeprice'); + } + //改分销佣金 + function changecommission(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $order = pdo_get('wlmerchant_disorder',array('id' => $id)); + $leadmoney = unserialize($order['leadmoney']); + $order['onemember'] = pdo_getcolumn(PDO_NAME.'distributor',array('id'=>$order['oneleadid']),'nickname'); + if($order['twoleadid']){ + $order['twomember'] = pdo_getcolumn(PDO_NAME.'distributor',array('id'=>$order['twoleadid']),'nickname'); + } + if ($_W['ispost']){ + $onemoney = $_GPC['onemoney']; + $twomoney = $_GPC['twomoney']; + if($onemoney < 0 || $twomoney < 0){ + show_json(0,'分销佣金不能为0,请重试'); + } + if($order['neworderflag']){ + $num = pdo_fetchcolumn('SELECT count(id) FROM '.tablename('wlmerchant_smallorder')." WHERE disorderid = {$id}"); + $newone = sprintf("%.2f",$onemoney/$num); + $newtow = sprintf("%.2f",$twomoney/$num); + pdo_update('wlmerchant_smallorder',array('onedismoney' => $newone,'twodismoney'=>$newtow),array('disorderid' => $id,'status'=>1)); + } + $newleadmoney['one'] = $onemoney; + $newleadmoney['two'] = $twomoney; + $newleadmoney = serialize($newleadmoney); + $res = pdo_update('wlmerchant_disorder',array('leadmoney' => $newleadmoney),array('id' => $id)); + if($res){ + show_json(1); + }else{ + show_json(0,'修改失败,请重试'); + } + } + + + include wl_template('order/changecommission'); + } + + //修改过期时间和状态 + function changetime(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $type = $_GPC['type']; + if($type == 'a'){ + $order = pdo_get('wlmerchant_order',array('id' => $id),array('id','aid','sid','plugin','estimatetime','recordid','fkid','issettlement','orderno')); + if($order['plugin'] == 'wlfightgroup'){$plugin = 2;} + if($order['plugin'] == 'coupon'){$plugin = 3;} + if($order['plugin'] == 'groupon'){$plugin = 10;} + }else{ + $order = pdo_get('wlmerchant_rush_order',array('id' => $id),array('id','aid','sid','estimatetime','activityid','issettlement','orderno')); + $plugin = 1; + } + if ($_W['ispost']){ + $time = strtotime($_GPC['estimatetime']); + if($type == 'a'){ + if($_GPC['classtype']){ + if($time < time()){ + $res2 = pdo_update('wlmerchant_order',array('estimatetime' => $time,'status'=>9),array('fkid' => $order['fkid'],'plugin' => $order['plugin'],'status'=>1)); + }else{ + $res2 = pdo_update('wlmerchant_order',array('estimatetime' => $time,'status'=>1),array('fkid' => $order['fkid'],'plugin' => $order['plugin'],'status'=>[1,9])); + } + if($order['plugin'] == 'coupon' ){ + pdo_update('wlmerchant_member_coupons',array('endtime' => $time),array('parentid' => $order['fkid'],'status'=>1)); + } + }else{ + if($time < time()){ + $res1 = pdo_update('wlmerchant_order',array('estimatetime' => $time,'status'=>9),array('id' => $id,'status' => 1)); + }else{ + $res1 = pdo_update('wlmerchant_order',array('estimatetime' => $time,'status'=>1,'issettlement'=>0),array('id' => $id,'status' => [1,9])); + } + if($order['plugin'] == 'coupon'){ + pdo_update('wlmerchant_member_coupons',array('endtime' => $time,'status'=>1),array('id' => $order['recordid'])); + } + } + }else{ + if($_GPC['classtype']){ +// if($time > time()){ +// $orders = pdo_getall('wlmerchant_rush_order',array('activityid' => $order['activityid'],'issettlement' => 1,'status'=>9),array('id','aid','sid','issettlement','orderno')); +// foreach ($orders as $key => $aor){ +// $settlement = pdo_get('wlmerchant_autosettlement_record',array('orderid' => $aor['id'],'type'=> $plugin)); +// if($settlement['agentmoney'] > 0){ +// pdo_fetch("update" . tablename('wlmerchant_agentusers') . "SET allmoney=allmoney-{$settlement['agentmoney']},nowmoney=nowmoney-{$settlement['agentmoney']} WHERE id = {$aor['aid']}"); +// $changeagentnowmoney = pdo_getcolumn(PDO_NAME . 'agentusers', array('id' => $aor['aid']), 'nowmoney'); +// Store::addcurrent(2,-1,$aor['aid'],-$settlement['agentmoney'],$changeagentnowmoney,'','后台修改['.$aor['orderno'].']订单时限扣除已结算金额'); +// } +// if($settlement['merchantmoney'] > 0){ +// pdo_fetch("update" . tablename('wlmerchant_merchantdata') . "SET allmoney=allmoney-{$settlement['merchantmoney']},nowmoney=nowmoney-{$settlement['merchantmoney']} WHERE id = {$aor['sid']}"); +// $changemerchantnowmoney = pdo_getcolumn(PDO_NAME . 'merchantdata', array('id' => $aor['sid']), 'nowmoney'); +// Store::addcurrent(1,-1,$aor['sid'],-$settlement['merchantmoney'],$changemerchantnowmoney,'','后台修改['.$aor['orderno'].']订单时限扣除已结算金额'); +// } +// pdo_delete('wlmerchant_autosettlement_record',array('id'=>$settlement['id'])); +// } +// } + $res2 = pdo_update('wlmerchant_rush_order',array('estimatetime' => $time),array('activityid' => $order['activityid'],'status'=>1)); + $res1 = pdo_update('wlmerchant_rush_order',array('estimatetime' => $time,'status'=>1,'issettlement'=>0),array('activityid' => $order['activityid'],'status'=>9)); + }else{ +// if($order['issettlement']){ +// $settlement = pdo_get('wlmerchant_autosettlement_record',array('orderid' => $order['id'],'type'=> $plugin)); +// if($settlement['agentmoney'] > 0){ +// pdo_fetch("update" . tablename('wlmerchant_agentusers') . "SET allmoney=allmoney-{$settlement['agentmoney']},nowmoney=nowmoney-{$settlement['agentmoney']} WHERE id = {$order['aid']}"); +// $changeagentnowmoney = pdo_getcolumn(PDO_NAME . 'agentusers', array('id' => $order['aid']), 'nowmoney'); +// Store::addcurrent(2,-1,$order['aid'],-$settlement['agentmoney'],$changeagentnowmoney,'','后台修改['.$order['orderno'].']订单时限扣除已结算金额'); +// } +// if($settlement['merchantmoney'] > 0){ +// pdo_fetch("update" . tablename('wlmerchant_merchantdata') . "SET allmoney=allmoney-{$settlement['merchantmoney']},nowmoney=nowmoney-{$settlement['merchantmoney']} WHERE id = {$order['sid']}"); +// $changemerchantnowmoney = pdo_getcolumn(PDO_NAME . 'merchantdata', array('id' => $order['sid']), 'nowmoney'); +// Store::addcurrent(1,-1,$order['sid'],-$settlement['merchantmoney'],$changemerchantnowmoney,'','后台修改['.$order['orderno'].']订单时限扣除已结算金额'); +// } +// pdo_delete('wlmerchant_autosettlement_record',array('id'=>$settlement['id'])); +// } + $res1 = pdo_update('wlmerchant_rush_order',array('estimatetime' => $time,'status'=>1,'issettlement'=>0),array('id' => $id)); + } + } + if($res1 || $res2){ + show_json(1); + }else{ + show_json(0,'修改失败,请重试'); + } + } + + include wl_template('order/changetime'); + } + //收货 + function collect(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $type = $_GPC['type']; + if($type == 'a'){ + $plugin = pdo_getcolumn(PDO_NAME.'order',array('id'=>$id),'plugin'); + }else if($type == 'consumption'){ + $plugin = 'consumption'; + }else{ + $plugin = 'rush'; + } + $res = Order::sureReceive($id,$plugin); + if($res){ + show_json(1); + }else{ + show_json(0,'收货失败请重试'); + } + } + //取消发货 + function sendcancel(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $type = $_GPC['type']; + $settings = Setting::wlsetting_read('orderset'); + if($type == 'a'){ + $res = pdo_update('wlmerchant_order', array('status' => 8), array('id' => $id)); + $expressid = pdo_getcolumn(PDO_NAME.'order',array('id'=>$id),'expressid'); + }else if($type == 'consumption'){ + $res = pdo_update('wlmerchant_consumption_record', array('status' => 1), array('id' => $id)); + $expressid = pdo_getcolumn(PDO_NAME.'consumption_record',array('id'=>$id),'expressid'); + }else{ + $res = pdo_update('wlmerchant_rush_order', array('status' => 8), array('id' => $id)); + $expressid = pdo_getcolumn(PDO_NAME.'rush_order',array('id'=>$id),'expressid'); + } + pdo_update('wlmerchant_express', array('expressname' => '','expresssn'=>'','sendtime'=>0), array('id' => $expressid)); + if($settings['receipt']>0){ + pdo_delete('wlmerchant_waittask',array('important'=>$id,'key'=>6,'status'=>0)); + } + if($res){ + show_json(1); + }else{ + show_json(0,'取消失败请重试'); + } + } + //物流查询 + function logisticsrecord(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $logisticsInfo = Logistics::orderLogisticsInfo($id); + if ($logisticsInfo['Traces']) { + $list = array_reverse($logisticsInfo['Traces']); + }else{ + $list = []; + $reason = $logisticsInfo['Reason']; + } + + include wl_template('order/express'); + } + //核销记录 + function hexiaorecord(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $type = $_GPC['type']; + if($type == 'a'){ + $order = pdo_get('wlmerchant_order',array('id' => $id),array('plugin','recordid','specid','neworderflag')); + if($order['neworderflag'] > 0){ + $usetimes = pdo_fetchcolumn('SELECT count(id) FROM '.tablename('wlmerchant_smallorder')." WHERE plugin = '{$order['plugin']}' AND orderid = {$id} AND status = 1"); + $smallorder = pdo_getall('wlmerchant_smallorder',array('orderid' => $id,'plugin'=>$order['plugin']),'','','status ASC,hexiaotime ASC'); + }else{ + if($order['plugin'] == 'wlfightgroup'){ + $record = pdo_get('wlmerchant_fightgroup_userecord',array('id' => $order['recordid']),array('usetimes','usedtime')); + $usetimes = $record['usetimes']; + $usedtime = unserialize($record['usedtime']); + }else if($order['plugin'] == 'coupon'){ + $record = pdo_get('wlmerchant_member_coupons',array('id' => $order['recordid']),array('usetimes','usedtime')); + $usetimes = $record['usetimes']; + $usedtime = unserialize($record['usedtime']); + }else if($order['plugin'] == 'groupon'){ + $record = pdo_get('wlmerchant_groupon_userecord',array('id' => $order['recordid']),array('usetimes','usedtime')); + $usetimes = $record['usetimes']; + $usedtime = unserialize($record['usedtime']); + }else if($order['plugin'] == 'bargain'){ + $record = pdo_get('wlmerchant_bargain_userlist',array('id' => $order['specid']),array('usetimes','usedtime')); + $usetimes = $record['usetimes']; + $usedtime = unserialize($record['usedtime']); + } + } + + + }else{ + $order = pdo_get('wlmerchant_rush_order',array('id' => $id),array('usetimes','usedtime','neworderflag')); + if($order['neworderflag']){ + $usetimes = pdo_fetchcolumn('SELECT count(id) FROM '.tablename('wlmerchant_smallorder')." WHERE plugin = 'rush' AND orderid = {$id} AND status = 1"); + $smallorder = pdo_getall('wlmerchant_smallorder',array('orderid' => $id,'plugin'=>'rush'),'','','status ASC,hexiaotime ASC'); + }else{ + $usetimes = $order['usetimes']; + $usedtime = unserialize($order['usedtime']); + } + + } + if($smallorder){ + $usedtime = array(); + foreach ($smallorder as $key => $sm) { + $va['status'] = $sm['status']; + if($sm['status'] == 2){ + $va['time'] = date("Y-m-d H:i:s",$sm['hexiaotime']); + }else if($sm['status'] == 3){ + $va['time'] = date("Y-m-d H:i:s",$sm['refundtime']); + } + if($sm['hxuid']){ + $va['ver'] = pdo_getcolumn(PDO_NAME.'merchantuser',array('id'=>$sm['hxuid']),'name'); + }else{ + $va['ver'] = '无'; + } + switch ($sm['hexiaotype']) { + case '1': + $va['type'] = '输码核销'; + break; + case '2': + $va['type'] = '扫码核销'; + break; + case '3': + $va['type'] = '后台核销'; + break; + case '4': + $va['type'] = '密码核销'; + break; + case '5': + $va['type'] = '系统自动核销'; + break; + default: + $va['type'] = '未知方式'; + break; + } + $va['checkcode'] = $sm['checkcode']; + $usedtime[] = $va; + } + }else if($usedtime){ + foreach ($usedtime as $key => &$va) { + $va['status'] = 2; + $va['time'] = date("Y-m-d H:i:s",$va['time']); + $va['ver'] = pdo_getcolumn(PDO_NAME.'merchantuser',array('mid'=>$va['ver']),'name'); + if(empty($va['ver'])){ + $va['ver'] = pdo_getcolumn(PDO_NAME.'member',array('id'=>$va['ver']),'nickname'); + if(empty($va['ver'])){ + $va['ver'] = '无'; + } + } + switch ($va['type']) { + case '1': + $va['type'] = '输码核销'; + break; + case '2': + $va['type'] = '扫码核销'; + break; + case '3': + $va['type'] = '后台核销'; + break; + case '4': + $va['type'] = '密码核销'; + break; + default: + $va['type'] = '未知方式'; + break; + } + } + } + include wl_template('order/hexiaorecord'); + } + //修改收货人信息 + function changeexpress(){ + global $_W, $_GPC; + $expressid = $_GPC['expressid']; + $express = pdo_get(PDO_NAME.'express',array('id' => $expressid)); + + if ($_W['ispost']){ + $data['name'] = trim($_GPC['name']); + $data['tel'] = trim($_GPC['tel']); + $data['address'] = $_GPC['address']; + $res = pdo_update('wlmerchant_express',$data,array('id' => $expressid)); + if($res){ + show_json(1); + }else{ + show_json(0,'修改失败请重试'); + } + } + + include wl_template('order/changeexpress'); + } + //详情页单独核销码核销 + function fetchcheck(){ + global $_W, $_GPC; + $checkcode = $_GPC['checkcode']; + $order = pdo_get(PDO_NAME . 'smallorder', array('uniacid' => $_W['uniacid'], 'checkcode' => $checkcode)); + if ($order) { + if ($order['status'] == 1) { + if ($order['plugin'] == 'rush') { + $res = Rush::hexiaoorder($order['orderid'], $_W['mid'], 1, 3, $order['checkcode']); + } else if ($order['plugin'] == 'groupon') { + $res = Groupon::hexiaoorder($order['orderid'], $_W['mid'], 1, 3, $order['checkcode']); + } else if ($order['plugin'] == 'wlfightgroup') { + $res = Wlfightgroup::hexiaoorder($order['orderid'], $_W['mid'], 1, 3, $order['checkcode']); + } else if ($order['plugin'] == 'bargain') { + $res = Bargain::hexiaoorder($order['orderid'], $_W['mid'], 1, 3, $order['checkcode']); + } else if ($order['plugin'] == 'coupon') { + $couponid = pdo_getcolumn(PDO_NAME . 'order', array('id' => $order['orderid']), 'recordid'); + $res = wlCoupon::hexiaoorder($couponid, $_W['mid'], 1,3, $order['checkcode']); + } else if ($order['plugin'] == 'activity') { + $res = Activity::hexiaoorder($order['orderid'], $_W['mid'], 1, 3, $order['checkcode']); + } + if ($res) { + show_json(1); + } else { + show_json(0,'使用失败,请刷新重试'); + } + } else { + show_json(0,'此核销码已核销完成'); + } + } else { + show_json(0,'核销码无效,请刷新重试'); + } + } + + + //后台核销 + function fetch(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $type = $_GPC['type']; + if($type == 'a'){ + $order = pdo_get('wlmerchant_order',array('id' => $id),array('neworderflag','plugin')); + $plugin = $order['plugin']; + if($order['neworderflag']){ + if($plugin == 'groupon'){ + $num = pdo_fetchcolumn('SELECT count(id) FROM '.tablename('wlmerchant_smallorder')." WHERE plugin = 'groupon' AND orderid = {$id} AND status = 1"); + $res = Groupon::hexiaoorder($id,-1,$num,3); + }else if($plugin == 'wlfightgroup'){ + $num = pdo_fetchcolumn('SELECT count(id) FROM '.tablename('wlmerchant_smallorder')." WHERE plugin = 'wlfightgroup' AND orderid = {$id} AND status = 1"); + $res = Wlfightgroup::hexiaoorder($id,-1,$num,3); + }else if($plugin == 'coupon'){ + $recordid = pdo_getcolumn(PDO_NAME.'order',array('id'=>$id),'recordid'); + $num = pdo_fetchcolumn('SELECT count(id) FROM '.tablename('wlmerchant_smallorder')." WHERE plugin = 'coupon' AND orderid = {$id} AND status = 1"); + $res = wlCoupon::hexiaoorder($recordid,-1,$num,3); + }else if($plugin == 'bargain'){ + $res = Bargain::hexiaoorder($id,-1,1,3); + }else if($plugin == 'activity'){ + $res = Activity::hexiaoorder($id,-1,1,3); + } + }else{ + if($plugin == 'wlfightgroup'){ + $recordid = pdo_getcolumn(PDO_NAME.'order',array('id'=>$id),'recordid'); + $num = pdo_getcolumn(PDO_NAME.'fightgroup_userecord',array('id'=>$recordid),'usetimes'); + $res = Wlfightgroup::hexiaoorder($id,-1,$num,3); + }else if($plugin == 'coupon'){ + $recordid = pdo_getcolumn(PDO_NAME.'order',array('id'=>$id),'recordid'); + $num = pdo_getcolumn(PDO_NAME.'member_coupons',array('id'=>$recordid),'usetimes'); + $res = wlCoupon::hexiaoorder($recordid,-1,$num,3); + }else if($plugin == 'groupon'){ + $recordid = pdo_getcolumn(PDO_NAME.'order',array('id'=>$id),'recordid'); + $num = pdo_getcolumn(PDO_NAME.'groupon_userecord',array('id'=>$recordid),'usetimes'); + $res = Groupon::hexiaoorder($id,-1,$num,3); + }else if($plugin == 'bargain'){ + $usetimes = pdo_getcolumn(PDO_NAME.'bargain_userlist',array('orderid'=>$id),'usetimes'); + $res = Bargain::hexiaoorder($id,-1,$usetimes,3); + }else if($plugin == 'citydelivery'){ + $res = Citydelivery::hexiaoorder($id,3); + } + } + }else{ + $item = Rush::getSingleOrder($id, '*'); + if($item['neworderflag']){ + $item['usetimes'] = pdo_fetchcolumn('SELECT count(id) FROM '.tablename('wlmerchant_smallorder')." WHERE plugin = 'rush' AND orderid = {$id} AND status = 1"); + } + $res = Rush::hexiaoorder($id,-1,$item['usetimes'],3); + } + if($res){ + show_json(1); + }else{ + show_json(0,'使用失败,请刷新重试'); + } + } + //完成 + function finish(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $type = $_GPC['type']; + if($type == 'a'){ + $res = pdo_update('wlmerchant_order',array('status' => 3),array('id' => $id)); + }else{ + $res = pdo_update('wlmerchant_rush_order',array('status' => 3),array('id' => $id)); + } + if($res){ + show_json(1); + }else{ + show_json(0,'完成失败,请刷新重试'); + } + } + //退款 + function refund(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $type = $_GPC['type']; + $checkcode = $_GPC['checkcode']; + $afterid = $_GPC['afterid']; + if ($_W['ispost']) { + $unline = $_GPC['refund_type']; + $retype = $_GPC['price_type']; + if($retype){ + $money = sprintf("%.2f",$_GPC['price_value']); + if($money<0.01){ + show_json(0, '退款金额不能为0'); + } + }else{ + $money = 0; + } + if($afterid){ + $after = pdo_get('wlmerchant_aftersale',array('id' => $afterid),array('checkcodes','orderid','plugin')); + $checkcodes = unserialize($after['checkcodes']); + } + if($afterid){ //售后处理 + if(empty($money)){ + //获取订单信息 + if($after['plugin'] == 'rush'){ + $orderInfo = pdo_get(PDO_NAME."rush_order",['id'=>$after['orderid']],['expressid','actualprice']); + $orderInfo['price'] = $orderInfo['actualprice']; + }else{ + $orderInfo = pdo_get(PDO_NAME."order",['id'=>$after['orderid']],['expressid','price']); + } + //判断是否快递订单还是核销订单 + if(empty($checkcodes)){ + $money = $orderInfo['price']; + }else{ + $money = pdo_getcolumn('wlmerchant_smallorder',array('checkcode' => $checkcodes),array("SUM(orderprice)")); + } + } + if ($type != 'a') { + $plugin = pdo_getcolumn(PDO_NAME . 'order', array('id' => $id), 'plugin'); + if ($plugin == 'wlfightgroup') { + $res = Wlfightgroup::refund($id,$money,$unline,0,$afterid); + } else if ($plugin == 'coupon') { + $res = wlCoupon::refund($id,$money,$unline,0,$afterid); + } else if ($plugin == 'groupon') { + $res = Groupon::refund($id,$money,$unline,0,$afterid); + } else if ($plugin == 'bargain') { + $res = Bargain::refund($id,$money,$unline); + } else if ($plugin == 'citydelivery'){ + $res = Citydelivery::refund($id,$money,$unline); + } else if ($plugin == 'activity'){ + $res = Activity::refundorder($id,$money,$unline,0,$afterid); + } else if ($plugin == 'housekeep'){ + $res = Housekeep::refund($id,$money,$unline); + } + } else { + $res = Rush::refund($id, $money, $unline,0,$afterid); + } + //修改售后记录 + if($res['status']){ + if($unline == 1){ + $refundtype = '线下转款给用户'; + }else if($unline == 1){ + $refundtype = '退款到用户余额'; + }else { + $refundtype = '根据支付方式原路退款'; + } + $journal = array( + 'time' => time(), + 'title' => '到账成功', + 'detail' => '商家已退款:'.$refundtype, + ); + $journals = Order::addjournal($journal,$afterid); + pdo_update('wlmerchant_aftersale',array('dotime' => time(),'status'=>2,'journal'=>$journals),array('id' =>$afterid)); + pdo_update('wlmerchant_smallorder',array('status' => 3, 'refundtime' => time()),array('checkcode' =>$checkcodes,'status'=> array(1,4))); + } + }else{ + //退款操作 + if ($type == 'a') { + $plugin = pdo_getcolumn(PDO_NAME . 'order', array('id' => $id), 'plugin'); + if ($plugin == 'wlfightgroup') { + $res = Wlfightgroup::refund($id,$money,$unline,$checkcode); + } else if ($plugin == 'coupon') { + $res = wlCoupon::refund($id,$money,$unline,$checkcode); + } else if ($plugin == 'groupon') { + $res = Groupon::refund($id,$money,$unline,$checkcode); + } else if ($plugin == 'bargain') { + $res = Bargain::refund($id,$money,$unline); + } else if ($plugin == 'citydelivery'){ + $res = Citydelivery::refund($id,$money,$unline); + } else if ($plugin == 'activity'){ + $res = Activity::refundorder($id,$money,$unline); + } else if ($plugin == 'housekeep'){ + $res = Housekeep::refund($id,$money,$unline); + } + //修改售后记录 + if($res['status']){ + $afters = pdo_getall('wlmerchant_aftersale',array('orderid' => $id,'status'=>1,'plugin'=>$plugin),array('id','checkcodes')); + if(!empty($afters)){ + if($unline == 1){ + $refundtype = '线下转款给用户'; + }else if($unline == 1){ + $refundtype = '退款到用户余额'; + }else { + $refundtype = '根据支付方式原路退款'; + } + $journal = array( + 'time' => time(), + 'title' => '到账成功', + 'detail' => '商家已退款:'.$refundtype, + ); + foreach ($afters as $af){ + $journals = Order::addjournal($journal,$af['id']); + $af['checkcodes'] = unserialize($af['checkcodes']); + if(empty($checkcode) || in_array($checkcode,$af['checkcodes'])){ + pdo_update('wlmerchant_aftersale',array('dotime' => time(),'status'=>2,'journal'=>$journals),array('id' => $af['id'])); + } + } + } + } + } else { + $res = Rush::refund($id, $money, $unline,$checkcode); + if($res['status']){ + $afters = pdo_getall('wlmerchant_aftersale',array('orderid' => $id,'status'=>1,'plugin'=>'rush'),array('id','checkcodes')); + if(!empty($afters)){ + if($unline == 1){ + $refundtype = '线下转款给用户'; + }else if($unline == 1){ + $refundtype = '退款到用户余额'; + }else { + $refundtype = '根据支付方式原路退款'; + } + $journal = array( + 'time' => time(), + 'title' => '到账成功', + 'detail' => '商家已退款:'.$refundtype, + ); + foreach ($afters as $af){ + $journals = Order::addjournal($journal,$af['id']); + $af['checkcodes'] = unserialize($af['checkcodes']); + if(empty($checkcode) || in_array($checkcode,$af['checkcodes'])) { + pdo_update('wlmerchant_aftersale', array('dotime' => time(), 'status' => 2, 'journal' => $journals), array('id' => $af['id'])); + } + } + } + } + } + } + if ($res['status']) { + show_json(1); + } else { + show_json(0, '退款失败:' . $res['message']); + } + } + + include wl_template('order/refund'); + } + //关闭 + function close(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $type = $_GPC['type']; + if($type == 'a'){ + $res = pdo_update('wlmerchant_order',array('status' => 5),array('id' => $id)); + if($res){ + $order = pdo_get('wlmerchant_order',array('id' => $id),array('num','specid','redpackid')); + if($order['redpackid']){ + pdo_update('wlmerchant_redpack_records',array('status' => 0,'usetime' =>0,'orderid' => 0,'plugin' =>''),array('id' => $order['redpackid'])); + } + if($order['specid']){ + pdo_fetch("update" . tablename('wlmerchant_goods_option') . "SET stock=stock+{$order['num']} WHERE id = {$order['specid']}"); + } + } + }else{ + $res = pdo_update('wlmerchant_rush_order',array('status' => 5),array('id' => $id)); + if($res){ + $order = pdo_get('wlmerchant_rush_order',array('id' => $id),array('num','optionid','redpackid')); + if($order['optionid']){ + pdo_fetch("update" . tablename('wlmerchant_goods_option') . "SET stock=stock+{$order['num']} WHERE id = {$order['optionid']}"); + } + if($order['redpackid']){ + pdo_update('wlmerchant_redpack_records',array('status' => 0,'usetime' =>0,'orderid' => 0,'plugin' =>''),array('id' => $order['redpackid'])); + } + } + } + if($res){ + show_json(1); + }else{ + show_json(0,'完成失败,请刷新重试'); + } + } + //修改商家备注 + function remarksaler(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $type = $_GPC['type']; + if($type == 'a'){ + $remark = pdo_getcolumn(PDO_NAME.'order',array('id'=>$id),'remark'); + }else{ + $remark = pdo_getcolumn(PDO_NAME.'rush_order',array('id'=>$id),'adminremark'); + } + if($_W['ispost']){ + $newremark = trim($_GPC['remark']); + if($type == 'a'){ + $res = pdo_update('wlmerchant_order',array('remark' => $newremark),array('id' => $id)); + }else{ + $res = pdo_update('wlmerchant_rush_order',array('adminremark' => $newremark),array('id' => $id)); + } + if($res){ + show_json(1); + }else{ + show_json(0,'备注失败,请刷新重试'); + } + } + include wl_template('order/remarksaler'); + } + + //生成分销订单 + public function createdisorder(){ + global $_W, $_GPC; + $id = $_GPC['id']; + $type = $_GPC['type']; + if($type == 'a'){ + $order = pdo_get('wlmerchant_order',array('id' => $id),array('vipdiscount','goodsprice','fkid','mid','sid','expressid','expressprcie','price','plugin','specid','num','vipbuyflag','cerditmoney')); + if($order['cerditmoney'] > 0 && $_W['wlsetting']['creditset']['nodistribution'] > 0){ + show_json(0,'积分抵扣订单无法产生分销订单'); + } + $disprice = sprintf("%.2f",$order['goodsprice'] - $order['vipdiscount']); + if($order['plugin'] == 'groupon'){ + $plugin = 'groupon'; + $goods = pdo_get('wlmerchant_groupon_activity',array('id' => $order['fkid']),array('disarray','dissettime','isdistristatus')); + if ($order['specid']>0) { + $option = pdo_get('wlmerchant_goods_option', array('id' => $order['specid']), array('disarray')); + $goods['disarray'] = WeliamWeChat::mergeDisArray($option['disarray'],$goods['disarray']); + } + $disarray = unserialize($goods['disarray']); + }else if($order['plugin'] == 'wlfightgroup'){ + $plugin = 'fightgroup'; + $goods = pdo_get('wlmerchant_fightgroup_goods',array('id' => $order['fkid']),array('disarray','dissettime','isdistristatus')); + if ($order['specid']>0) { + $option = pdo_get('wlmerchant_goods_option', array('id' => $order['specid']), array('disarray')); + $goods['disarray'] = WeliamWeChat::mergeDisArray($option['disarray'],$goods['disarray']); + } + $disarray = unserialize($goods['disarray']); + }else if($order['plugin'] == 'coupon'){ + $plugin = 'coupon'; + $goods = pdo_get('wlmerchant_couponlist',array('id' => $order['fkid']),array('disarray','dissettime','isdistristatus')); + $disarray = unserialize($goods['disarray']); + }else if($order['plugin'] == 'bargain'){ + $plugin = 'bargain'; + $goods = pdo_get('wlmerchant_bargain_activity',array('id' => $order['fkid']),array('disarray','dissettime','isdistristatus')); + $disarray = unserialize($goods['disarray']); + }else if($order['plugin'] == 'citydelivery'){ + $plugin = 'citydelivery'; + $sdisarray = pdo_get('wlmerchant_merchantdata',array('id' => $order['sid']),array('deliverydisstatus','onescale','twoscale')); + $disarray = 0; + if($sdisarray['deliverydisstatus'] > 0 ){ + if($sdisarray['onescale'] > 0){ + $onemoney = sprintf("%.2f",$disprice * $sdisarray['onescale'] / 100); + } + if($sdisarray['twoscale'] > 0){ + $twomoney = sprintf("%.2f",$disprice * $sdisarray['twoscale'] / 100); + } + } + }else if($order['plugin'] == 'activity'){ + $plugin = 'activity'; + $goods = pdo_get('wlmerchant_activitylist',array('id' => $order['fkid']),array('disarray','dissettime','isdistristatus')); + if ($order['specid']>0) { + $option = pdo_get('wlmerchant_activity_spec', array('id' => $order['specid']), array('disarray')); + $goods['disarray'] = WeliamWeChat::mergeDisArray($option['disarray'],$goods['disarray']); + } + $disarray = unserialize($goods['disarray']); + } + }else{ + //抢购 + $order = pdo_get('wlmerchant_rush_order',array('id' => $id),array('activityid','mid','price','expressid','discount','optionid','actualprice','num','vipbuyflag','dkmoney')); + if($order['dkmoney'] > 0 && $_W['wlsetting']['creditset']['nodistribution'] > 0){ + show_json(0,'积分抵扣订单无法产生分销订单'); + } + $disprice = sprintf("%.2f",$order['price'] - $order['discount']); + $plugin = 'rush'; + $goods = pdo_get('wlmerchant_rush_activity',array('id' => $order['activityid']),array('disarray','dissettime','isdistristatus')); + if ($order['optionid']>0) { + $option = pdo_get('wlmerchant_goods_option', array('id' => $order['optionid']), array('disarray')); + $goods['disarray'] = WeliamWeChat::mergeDisArray($option['disarray'],$goods['disarray']); + } + $disarray = unserialize($goods['disarray']); + } + //判断分销商资格 + $distributorid = pdo_getcolumn(PDO_NAME.'member',array('uniacid'=>$_W['uniacid'],'id'=>$order['mid']),'distributorid'); + if(empty($distributorid)){ + show_json(0,'该用户无分销上级,无法生成分销订单'); + }else{ + $distributor = pdo_get(PDO_NAME.'distributor',array('uniacid'=>$_W['uniacid'],'id'=>$distributorid),array('leadid','disflag','dislevel')); + if($distributor['disflag']){ + $mleveid = $distributor['dislevel']; + if(empty($mleveid)){ + $mleveid = pdo_getcolumn('wlmerchant_dislevel',array('uniacid' =>$_W['uniacid'],'isdefault'=>1),'id'); + } + $memberlevel = pdo_get(PDO_NAME.'dislevel',array('id'=>$mleveid),array('ownstatus')); + } + if(empty($distributor['leadid']) && empty($memberlevel['ownstatus'])){ + show_json(0,'该用户无分销上级,无法生成分销订单'); + } + } + if(empty($plugin)){ + show_json(0,'订单插件错误,请联系管理员'); + } + $disorderid = Distribution::disCore($order['mid'],$disprice,$disarray,$order['num'],0,$id,$plugin,$goods['dissettime'],$goods['isdistristatus']); + if($disorderid){ + if($type == 'a'){ + $res = pdo_update('wlmerchant_order',array('disorderid' => $disorderid),array('id' => $id)); + }else{ + $res = pdo_update('wlmerchant_rush_order',array('disorderid' => $disorderid),array('id' => $id)); + } + if($res){ + show_json(1); + }else{ + show_json(0,'关联分销订单失败,请联系管理员'); + } + }else{ + show_json(0,'该订单无法生成分销订单。'); + } + + + } + + + /** + * Comment: 根据条件获取订单信息 + * Author: zzw + * @param $where 条件一 查询rush_order表使用 + * @param $where2 条件二 查询order表使用 + * @return array + */ + static protected function getOrderInfo($where,$where2,$limit){ + $sql = 'SELECT a.id,a.moinfo,a.mobile,a.createtime,a.sid,a.status,a.paidprid,a.mid,a.orderno,a.num,a.price,a.paytype,a.vipbuyflag,a.paytime,a.changedispatchprice,a.changeprice,a.disorderid,a.applyrefund, "a", + f.qrcode as fqrcode, + g.qrcode as gqrcode, + `c`.concode as cqrcode, + b.qrcode as bqrcode FROM '.tablename(PDO_NAME."order") + ." a LEFT JOIN ".tablename(PDO_NAME."fightgroup_userecord")." f ON a.id = f.orderid AND a.plugin = 'wlfightgroup'" + ." LEFT JOIN ".tablename(PDO_NAME."groupon_userecord")." g ON a.id = g.orderid AND a.plugin = 'groupon'" + ." LEFT JOIN ".tablename(PDO_NAME."member_coupons")." `c` ON a.orderno = `c`.orderno AND a.plugin = 'coupon'" + ." LEFT JOIN ".tablename(PDO_NAME."bargain_userlist")." b ON a.id = b.orderid AND a.plugin = 'bargain' {$where2} " + .' UNION ALL SELECT id,moinfo,mobile,createtime,sid,status,paidprid,mid,orderno,num,actualprice as price,paytype,vipbuyflag,paytime,changedispatchprice,changeprice,disorderid,applyrefund, "b","rush","rush","rush","rush" FROM ' + .tablename(PDO_NAME."rush_order")." {$where} ORDER BY createtime DESC {$limit}"; + $orderlist = pdo_fetchall($sql); + + return $orderlist; + } + + /** + * Comment: 储存批量发货的.cvs文件 然后返回文件名称 + * Author: zzw + */ + public function bulkShipment(){ + global $_W, $_GPC; + #1、将获取表格文件存放进入临时存储文件 resource/name + $imageName = "excel" . time() . rand(1000, 9999) . '.csv'; + $imageName = "images/" . MODULE_NAME . "/" . $imageName;//文件储存路径 + $fullName = PATH_ATTACHMENT . $imageName;//文件在本地服务器暂存地址 + $res = move_uploaded_file($_FILES['file']['tmp_name'], $fullName); + if (!$res) { + wl_json(0, '操作失败,文件上传错误'); + } + wl_json(1, '文件上传成功,正在处理信息...', $imageName); + } + /** + * Comment: 批量发货 并且返回结果信息表 + * Author: zzw + */ + public function batchSend(){ + global $_W,$_GPC; + #1、将获取基本信息 + $name = $_GPC['name'];//文件储存路径 + $fullName = PATH_ATTACHMENT . $name;//文件在本地服务器暂存地址 + #2、读取excel中的内容 + $info = util_csv::read_csv_lines($fullName, 999, 0); + unlink($fullName);//获取文件信息后将.cvs文件删除 + #3、对读取到的信息进行处理 + foreach ($info as $k => &$v) { + //3-1 判断是否存在数据 不存在是空行,不进行任何操作 + if (!is_array($v)) { + unset($info[$k]); + continue; + } + //3-2 编码转换 由gbk转为urf-8 + $separator = '*separator*';//分割符 写成长字符串 防止出错 + $encodres = mb_detect_encoding(implode($separator, $v), array("ASCII","GB2312","GBK","UTF-8")); + if($encodres != 'UTF-8'){ + $v = explode($separator, iconv('gbk', 'utf-8', implode($separator, $v))); + } + //3-3 订单状态不为待收货 不进行发货操作 + if (trim($v[9]) != '待发货') { + $v['send_result'] = '不进行发货操作'; + continue; + } + //3-4 获取需要的信息 + $orderType = trim($v[2]);//订单类型 + $orderId = trim($v[0]);//订单id + $expressName = trim($v[19]);//物流公司 + $expressNum = trim($v[20]);//物流快递号 + $sendResult = '发货成功';//当前订单发货结果 + //3-5 获取快递信息表的id + if ($orderType == '抢购') { + $expressId = pdo_getcolumn(PDO_NAME . "rush_order", array('id' => $orderId), 'expressid'); + } else if ($orderType == '拼团' || $orderType == '团购' || $orderType == '卡券' || $orderType == '砍价') { + $expressId = pdo_getcolumn(PDO_NAME . "order", array('id' => $orderId), 'expressid'); + } else { + $sendResult = '发货失败,仅支持抢购、拼团、团购、卡券、砍价商品的批量发货'; + } + //3-6 获取发货物流公司的英文名称 + $expressEName = Logistics::codeComparisonTable($expressName,'name'); + $expressEName = $expressEName['alias']; + if (!$expressEName) { + $sendResult = '不支持使用当前快递公司发货!'; + } + //3-7 进行发货操作 + if ($expressName && $expressId) { + $expressDate['expressname'] = $expressEName;//物流名称 + $expressDate['expresssn'] = $expressNum;//物流单号 + $expressDate['orderid'] = $orderId;//订单id + $expressDate['sendtime'] = time();//发货时间 + //修改物流信息表 + $updateRes = pdo_update(PDO_NAME."express",$expressDate,array('id'=>$expressId)); + //修改订单信息 + if ($orderType == '抢购') { + $UstateRes = pdo_update(PDO_NAME.'rush_order', array('status' => 4), array('id' => $orderId)); + News::sendremind($orderId,'b'); //发货提醒 + } else if ($orderType == '拼团' || $orderType == '团购' || $orderType == '卡券' || $orderType == '砍价') { + $UstateRes = pdo_update(PDO_NAME.'order', array('status' => 4), array('id' => $orderId)); + News::sendremind($orderId,'a'); //发货提醒 + } + if ($updateRes && $UstateRes) { + $sendResult = '发货成功'; + } else { + $sendResult = '发货失败,请检查信息是否填写正确或是否已发货!'; + } + } + unset($v[22]);unset($v[23]);unset($v[24]);unset($v[25]); + unset($v[26]);unset($v[27]);unset($v[28]);unset($v[29]); + unset($v[30]);unset($v[31]);unset($v[32]); + //3-8 进行发货结果的拼写 + $v['send_result'] = $sendResult; + } + #4、定义结果表格的标题 + $filter = array( + 0 => '订单id', + 1 => '订单号', + 2 => '所属应用', + 3 => '商品名称', + 4 => '规格名称', + 5 => '数量', + 6 => '所属商家', + 7 => '买家昵称', + 8 => '买家电话', + 9 => '订单状态', + 10 => '支付方式', + 11 => '下单时间', + 12 => '支付时间', + 13 => '实付金额', + 14 => '买家备注', + 15 => '卖家备注', + 16 => '收货人姓名', + 17 => '收货人电话', + 18 => '收货人地址', + 19 => '物流公司', + 20 => '快递单号', + 21 => '快递运费', + 'send_result' => '发货结果', + ); + #5、返回批量发货的结果信息表 + util_csv::export_csv_2($info, $filter, '批量发货结果信息.csv'); + } + + /** + * Comment: 完成配送订单 + * Author: wlf + * Date: 2019/04/22 18:31 + */ + public function finishdelivery(){ + global $_W,$_GPC; + $id = $_GPC['id']; + $order = pdo_get('wlmerchant_order',array('id' => $id),array('orderno','expressid')); + $res = pdo_update('wlmerchant_order',array('status' => 2,'deliverytype' => 3),array('id' => $id)); + if($res){ + pdo_update('wlmerchant_delivery_order',array('status' => 2,'dotime' => time()),array('tid' => $order['orderno'])); + $setres = Store::ordersettlement($id); + if($order['expressid']){ + pdo_update('wlmerchant_express',array('receivetime' => time()),array('id' => $order['expressid'])); + } + show_json(1,'处理成功'); + }else{ + show_json(0,'修改状态失败,请刷新重试'); + } + } + + /** + * Comment: 核销码列表 + * Author: wlf + * Date: 2019/07/22 09:43 + */ + public function checkcodeList(){ + global $_W,$_GPC; + $id = $_GPC['id']; + $plugin = $_GPC['plugin']; + $type = $_GPC['type'] ? $_GPC['type'] : 1; // 1核销码 2其他订单 + $status = $_GPC['status'] ? $_GPC['status'] : 1; //1已下单 2已支付 3已完成 + $pindex = max(1,intval($_GPC['page'])); + switch ($plugin){ + case 'rush': + $pluginno = 1; + break; + case 'wlfightgroup': + $pluginno = 2; + break; + case 'groupon': + $pluginno = 10; + break; + case 'bargain': + $pluginno = 12; + break; + case 'coupon': + $pluginno = 3; + break; + case 'activity': + $pluginno = 9; + break; + } + if(empty($id)){ + wl_message('无商品信息', referer(),'error'); + } + if(empty($plugin)){ + wl_message('无商品类型', referer(),'error'); + } + //商品信息 + if($plugin == 'rush'){ + $goodinfo = pdo_get('wlmerchant_rush_activity',array('id' => $id),array('name','thumb','sid','pftid','threestatus')); + $goodinfo['thumb'] = tomedia($goodinfo['thumb']); + }else if($plugin == 'groupon'){ + $goodinfo = pdo_get('wlmerchant_groupon_activity',array('id' => $id),array('name','thumb','sid','pftid','threestatus')); + $goodinfo['thumb'] = tomedia($goodinfo['thumb']); + }else if($plugin == 'wlfightgroup'){ + $goodinfo = pdo_get('wlmerchant_fightgroup_goods',array('id' => $id),array('name','logo','merchantid')); + $goodinfo['sid'] = $goodinfo['merchantid']; + $goodinfo['thumb'] = tomedia($goodinfo['logo']); + }else if($plugin == 'bargain'){ + $goodinfo = pdo_get('wlmerchant_bargain_activity',array('id' => $id),array('name','thumb','sid')); + $goodinfo['thumb'] = tomedia($goodinfo['thumb']); + }else if($plugin == 'coupon'){ + $goodinfo = pdo_get('wlmerchant_couponlist',array('id' => $id),array('title','logo','merchantid')); + $goodinfo['name'] = $goodinfo['title']; + $goodinfo['sid'] = $goodinfo['merchantid']; + $goodinfo['thumb'] = tomedia($goodinfo['logo']); + }else if($plugin == 'activity'){ + $goodinfo = pdo_get('wlmerchant_activitylist',array('id' => $id),array('title','thumb','sid')); + $goodinfo['name'] = $goodinfo['title']; + $goodinfo['thumb'] = tomedia($goodinfo['thumb']); + } + //商户信息 + if($goodinfo['sid'] > 0){ + $merchant = pdo_get('wlmerchant_merchantdata',array('id' => $goodinfo['sid']),array('storename','logo')); + $merchant['logo'] = tomedia($merchant['logo']); + }else if(empty($goodinfo['threestatus'])){ + $merchant['storename'] = '票付通平台商品'; + $merchant['logo'] = tomedia($_W['wlsetting']['base']['name']); + }else if($goodinfo['threestatus'] == 1){ + $merchant['storename'] = '亿奇达平台商品'; + $merchant['logo'] = tomedia($_W['wlsetting']['base']['name']); + }else{ + $merchant['storename'] = '其他平台商品'; + $merchant['logo'] = tomedia($_W['wlsetting']['base']['name']); + } + + + //核销码列表 + if($type == 1){ + $where = array( + 'uniacid' => $_W['uniacid'], + 'gid' => $id, + 'plugin' => $plugin + ); + if($status == 1 || $status == 2){ + $where['status#'] = '(1,2,4)'; + }else if($status == 3){ + $where['status'] = 2; + }else if($status == 4){ + $where['status'] = 3; + } + //条件筛选 + if(!empty($_GPC['keyword'])){ + $keyword = trim($_GPC['keyword']); + $keywordtype = $_GPC['keywordtype']; + switch ($keywordtype){ + case '1': + $where['orderno@'] = $keyword; + break; + case '2': + $where['checkcode@'] = $keyword; + break; + case '3': + $params[':name'] = "%{$keyword}%"; + $members = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_member')." WHERE uniacid = {$_W['uniacid']} AND nickname LIKE :name",$params); + if($members){ + $mids = "("; + foreach ($members as $key => $v) { + if($key == 0){ + $mids.= $v['id']; + }else{ + $mids.= ",".$v['id']; + } + } + $mids.= ")"; + $where['mid#'] = "{$mids}"; + } + break; + case '4': + $where['mid'] = $keyword; + break; + case '5': + $where['specid'] = $keyword; + break; + } + } + //时间筛选 + + if(!empty($_GPC['timetype'])){ + $timetype = $_GPC['timetype']; + $starttime = strtotime($_GPC['time_limit']['start']); + $endtime = strtotime($_GPC['time_limit']['end']); + if($timetype == 1){ + $where['createtime>'] = $starttime; + $where['createtime<'] = $endtime; + }else if($timetype == 2){ + $where['hexiaotime>'] = $starttime; + $where['hexiaotime<'] = $endtime; + } + } + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + //导出 + if($_GPC['export']){ + $this -> exportCheckcodeList($where,1); + } + + $lists = Util::getNumData('orderno,orderid,createtime,mid,status,specid,hexiaotime,hexiaotype,hxuid,checkcode,orderprice,plugin','wlmerchant_smallorder',$where,'id DESC',$pindex,20,1); + $list = $lists[0]; + $pager = $lists[1]; + $tatal = $lists[2]; + foreach($list as $k => &$li){ + $member = pdo_get(PDO_NAME.'member',array('id'=>$li['mid']),array('nickname','avatar')); + $li['nickname'] = $member['nickname']; + $li['avatar'] = tomedia($member['avatar']); + if($li['specid'] > 0){ + if($li['plugin'] == 'activity'){ + $li['specname'] = pdo_getcolumn(PDO_NAME.'activity_spec',array('uniacid'=>$_W['uniacid'],'id'=>$li['specid']),'name'); + }else{ + $li['specname'] = pdo_getcolumn(PDO_NAME.'goods_option',array('uniacid'=>$_W['uniacid'],'id'=>$li['specid']),'title'); + } + $li['specname'] = $li['specname'] ."(spid:".$li['specid'].")"; + }else{ + $li['specname'] = "- 无 -"; + } + if($li['hexiaotime'] > 0){ + $li['hexiaotime'] = date("Y-m-d H:i:s",$li['hexiaotime']); + } + $li['createtime'] = date("Y-m-d H:i:s",$li['createtime']); + switch ($li['status']){ + case '1': + $li['statuscss'] = 'warning'; + $li['statustext'] = '待核销'; + break; + case '2': + $li['statuscss'] = 'success'; + $li['statustext'] = '已核销'; + break; + case '3': + $li['statuscss'] = 'defualt'; + $li['statustext'] = '已退款'; + break; + case '4': + $li['statuscss'] = 'danger'; + $li['statustext'] = '申请退款中'; + break; + } + switch ($li['hexiaotype']){ + case '1': + $li['hxtypecss'] = 'defualt'; + $li['hxtypetext'] = '输码核销'; + break; + case '2': + $li['hxtypecss'] = 'success'; + $li['hxtypetext'] = '扫码核销'; + break; + case '3': + $li['hxtypecss'] = 'warning'; + $li['hxtypetext'] = '后台核销'; + break; + case '4': + $li['hxtypecss'] = 'info'; + $li['hxtypetext'] = '密码核销'; + break; + } + $hxuser = pdo_get(PDO_NAME.'merchantuser',array('id'=>$li['hxuid']),array('name','mid')); + $hxuserimg = pdo_getcolumn(PDO_NAME.'member',array('id'=>$hxuser['mid']),'avatar'); + $li['hxuser'] = $hxuser['name']; + $li['hxuserimg'] = tomedia($hxuserimg); + $li['orderurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$li['orderid'],'type'=>$pluginno)); + } + } + else if($type == 2){ + $pageStart = $pindex * 20 - 20 ; + //条件筛选 + if($plugin == 'rush'){ + $where = " a.uniacid = {$_W['uniacid']} AND a.activityid = {$id} "; + }else{ + $where = " a.uniacid = {$_W['uniacid']} AND a.fkid = {$id} "; + if($plugin == 'group'){ + $where .= " AND a.plugin = 'group' "; + }else if($plugin == 'wlfightgroup'){ + $where .= " AND a.plugin = 'wlfightgroup' "; + }else if($plugin == 'bargain'){ + $where .= " AND a.plugin = 'bargain' "; + } + } + if(!empty($_GPC['keyword'])){ + $keyword = trim($_GPC['keyword']); + $keywordtype = $_GPC['keywordtype']; + switch ($keywordtype){ + case '1': + $where .= " AND a.orderno LIKE '%{$keyword}%' "; + break; + case '3': + $where .= " AND a.mid = '{$keyword}' "; + break; + case '2': + $params[':name'] = "%{$keyword}%"; + $members = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_member')." WHERE uniacid = {$_W['uniacid']} AND nickname LIKE :name",$params); + if($members){ + $mids = "("; + foreach ($members as $key => $v) { + if($key == 0){ + $mids.= $v['id']; + }else{ + $mids.= ",".$v['id']; + } + } + $mids.= ")"; + $where .= " AND a.mid IN '{$mids}' "; + } + break; + case '4': + if($plugin == 'rush'){ + $where .= " AND a.optionid = '{$keyword}' "; + }else{ + $where .= " AND a.specid = '{$keyword}' "; + } + break; + } + } + //时间筛选 + if(!empty($_GPC['timetype'])){ + $timetype = $_GPC['timetype']; + $starttime = strtotime($_GPC['time_limit']['start']); + $endtime = strtotime($_GPC['time_limit']['end']); + if($timetype == 1){ + $where .= " AND a.paytime > '{$starttime}' "; + $where .= " AND a.paytime < '{$endtime}' "; + }else if($timetype == 3){ + $where .= " AND b.sendtime > '{$starttime}' "; + $where .= " AND b.sendtime < '{$endtime}' "; + }else if($timetype == 4){ + $where .= " AND b.receivetime > '{$starttime}' "; + $where .= " AND b.receivetime < '{$endtime}' "; + } + } + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + + //查询全部 + if($status == 1){ + $where .= " AND (a.status IN (0,4,8) OR (a.status IN (2,3) ))"; + }else if($status == 2){ + $where .= " AND (a.status IN (4,8) OR (a.status IN (2,3) ))"; + }else if($status == 3){ + $where .= " AND a.status IN (2,3) "; + }else if($status == 4){ + $where .= " AND a.status = 7 "; + } + if(empty($goodinfo['pftid'])){ + $where .= " AND a.expressid > 0"; + } + if($plugin == 'rush'){ + //导出 + if($_GPC['export']){ + $this -> exportCheckcodeList($where,2); + } + + $tatolPage = pdo_fetchcolumn("SELECT count(a.id) FROM " . tablename(PDO_NAME . "rush_order") + . " as a LEFT JOIN " . tablename(PDO_NAME . "express") + . " as b ON a.expressid = b.id WHERE {$where}"); + + $tatal = pdo_fetchcolumn("SELECT SUM(a.num) FROM " . tablename(PDO_NAME . "rush_order") + . " as a LEFT JOIN " . tablename(PDO_NAME . "express") + . " as b ON a.expressid = b.id WHERE {$where}"); + + $tatal = !empty($tatal)?$tatal:0; + $pager = wl_pagination($tatolPage,$pindex,20); + + $list = pdo_fetchall("SELECT a.mid,a.status,a.id,a.paytime,a.orderno,a.optionid,a.createtime,a.actualprice,a.num,b.sendtime,b.receivetime FROM " . tablename(PDO_NAME . "rush_order") + . " as a LEFT JOIN " . tablename(PDO_NAME . "express") + . " as b ON a.expressid = b.id WHERE {$where} ORDER BY a.id DESC LIMIT {$pageStart},20"); + + foreach($list as $k => &$li){ + $member = pdo_get(PDO_NAME.'member',array('id'=>$li['mid']),array('nickname','avatar')); + $li['nickname'] = $member['nickname']; + $li['avatar'] = tomedia($member['avatar']); + if($li['optionid'] > 0){ + $li['specname'] = pdo_getcolumn(PDO_NAME.'goods_option',array('uniacid'=>$_W['uniacid'],'id'=>$li['optionid']),'title'); + $li['specname'] = $li['specname'] ."(spid:".$li['optionid'].")"; + }else{ + $li['specname'] = "- 无 -"; + } + if($li['sendtime'] > 0){ + $li['sendtime'] = date("Y-m-d H:i:s",$li['sendtime']); + } + if($li['receivetime'] > 0){ + $li['receivetime'] = date("Y-m-d H:i:s",$li['receivetime']); + } + if($li['paytime'] > 0){ + $li['paytime'] = date("Y-m-d H:i:s",$li['paytime']); + } + $li['createtime'] = date("Y-m-d H:i:s",$li['createtime']); + $li['price'] = $li['actualprice']; + switch ($li['status']){ + case '0': + $li['statuscss'] = 'defualt'; + $li['statustext'] = '未支付'; + break; + case '2': + $li['statuscss'] = 'success'; + $li['statustext'] = '已收货'; + break; + case '3': + $li['statuscss'] = 'success'; + $li['statustext'] = '已收货'; + break; + case '4': + $li['statuscss'] = 'warning'; + $li['statustext'] = '待收货'; + break; + case '7': + $li['statuscss'] = 'defualt'; + $li['statustext'] = '已退款'; + break; + case '8': + $li['statuscss'] = 'info'; + $li['statustext'] = '待发货'; + break; + } + $li['orderurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$li['id'],'type'=>$pluginno)); + } + }else{ + //导出 + if($_GPC['export']){ + $this -> exportCheckcodeList($where,3); + } + $tatolPage = pdo_fetchcolumn("SELECT count(a.id) FROM " . tablename(PDO_NAME . "order") + . " as a LEFT JOIN " . tablename(PDO_NAME . "express") + . " as b ON a.expressid = b.id WHERE {$where}"); + + $tatal = pdo_fetchcolumn("SELECT SUM(a.num) FROM " . tablename(PDO_NAME . "order") + . " as a LEFT JOIN " . tablename(PDO_NAME . "express") + . " as b ON a.expressid = b.id WHERE {$where}"); + + $tatal = !empty($tatal)?$tatal:0; + $pager = wl_pagination($tatolPage,$pindex,20); + + $list = pdo_fetchall("SELECT a.mid,a.status,a.id,a.paytime,a.orderno,a.specid,a.createtime,a.price,a.num,b.sendtime,b.receivetime FROM " . tablename(PDO_NAME . "order") + . " as a LEFT JOIN " . tablename(PDO_NAME . "express") + . " as b ON a.expressid = b.id WHERE {$where} ORDER BY a.id DESC LIMIT {$pageStart},20"); + + foreach($list as $k => &$li){ + $member = pdo_get(PDO_NAME.'member',array('id'=>$li['mid']),array('nickname','avatar')); + $li['nickname'] = $member['nickname']; + $li['avatar'] = tomedia($member['avatar']); + if($li['specid'] > 0){ + $li['specname'] = pdo_getcolumn(PDO_NAME.'goods_option',array('uniacid'=>$_W['uniacid'],'id'=>$li['specid']),'title'); + $li['specname'] = $li['specname'] ."(spid:".$li['specid'].")"; + }else{ + $li['specname'] = "- 无 -"; + } + if($li['sendtime'] > 0){ + $li['sendtime'] = date("Y-m-d H:i:s",$li['sendtime']); + } + if($li['receivetime'] > 0){ + $li['receivetime'] = date("Y-m-d H:i:s",$li['receivetime']); + } + if($li['paytime'] > 0){ + $li['paytime'] = date("Y-m-d H:i:s",$li['paytime']); + } + $li['createtime'] = date("Y-m-d H:i:s",$li['createtime']); + switch ($li['status']){ + case '0': + $li['statuscss'] = 'defualt'; + $li['statustext'] = '未支付'; + break; + case '2': + $li['statuscss'] = 'success'; + $li['statustext'] = '已收货'; + break; + case '3': + $li['statuscss'] = 'success'; + $li['statustext'] = '已收货'; + break; + case '4': + $li['statuscss'] = 'warning'; + $li['statustext'] = '待收货'; + break; + case '8': + $li['statuscss'] = 'info'; + $li['statustext'] = '待发货'; + break; + } + $li['orderurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$li['id'],'type'=>$pluginno)); + } + } + } + else{ + $pageStart = $pindex * 20 - 20 ; + //条件筛选 + $where = " a.uniacid = {$_W['uniacid']} AND a.fkid = {$id} AND a.status = 1 AND a.fightgroupid > 0 AND b.status = 1 AND plugin = 'wlfightgroup' "; + if(!empty($_GPC['keyword'])){ + $keyword = trim($_GPC['keyword']); + $keywordtype = $_GPC['keywordtype']; + switch ($keywordtype){ + case '1': + $where .= " AND a.orderno LIKE '%{$keyword}%' "; + break; + case '3': + $where .= " AND a.mid = '{$keyword}' "; + break; + case '2': + $params[':name'] = "%{$keyword}%"; + $members = pdo_fetchall("SELECT * FROM ".tablename('wlmerchant_member')." WHERE uniacid = {$_W['uniacid']} AND nickname LIKE :name",$params); + if($members){ + $mids = "("; + foreach ($members as $key => $v) { + if($key == 0){ + $mids.= $v['id']; + }else{ + $mids.= ",".$v['id']; + } + } + $mids.= ")"; + $where .= " AND a.mid IN '{$mids}' "; + } + break; + case '4': + $where .= " AND a.specid = '{$keyword}' "; + break; + } + } + //时间筛选 + if(!empty($_GPC['timetype'])){ + $timetype = $_GPC['timetype']; + $starttime = strtotime($_GPC['time_limit']['start']); + $endtime = strtotime($_GPC['time_limit']['end']); + if($timetype == 1){ + $where .= " AND a.paytime > '{$starttime}' "; + $where .= " AND a.paytime < '{$endtime}' "; + }else if($timetype == 5){ + $where .= " AND b.failtime > '{$starttime}' "; + $where .= " AND b.failtime < '{$endtime}' "; + } + } + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + + //导出 + if($_GPC['export']){ + $this -> exportCheckcodeList($where,4); + } + + $tatolPage = pdo_fetchcolumn("SELECT count(a.id) FROM " . tablename(PDO_NAME . "order") + . " as a LEFT JOIN " . tablename(PDO_NAME . "fightgroup_group") + . " as b ON a.fightgroupid = b.id WHERE {$where}"); + + $tatal = pdo_fetchcolumn("SELECT SUM(a.num) FROM " . tablename(PDO_NAME . "order") + . " as a LEFT JOIN " . tablename(PDO_NAME . "fightgroup_group") + . " as b ON a.fightgroupid = b.id WHERE {$where}"); + + $tatal = !empty($tatal)?$tatal:0; + $pager = wl_pagination($tatolPage,$pindex,20); + + $list = pdo_fetchall("SELECT a.mid,a.status,a.id,a.paytime,a.orderno,a.specid,a.createtime,a.price,a.num,b.failtime FROM " . tablename(PDO_NAME . "order") + . " as a LEFT JOIN " . tablename(PDO_NAME . "fightgroup_group") + . " as b ON a.fightgroupid = b.id WHERE {$where} ORDER BY a.id DESC LIMIT {$pageStart},20"); + + foreach($list as $k => &$li){ + $member = pdo_get(PDO_NAME.'member',array('id'=>$li['mid']),array('nickname','avatar')); + $li['nickname'] = $member['nickname']; + $li['avatar'] = tomedia($member['avatar']); + if($li['specid'] > 0){ + $li['specname'] = pdo_getcolumn(PDO_NAME.'goods_option',array('uniacid'=>$_W['uniacid'],'id'=>$li['specid']),'title'); + $li['specname'] = $li['specname'] ."(spid:".$li['specid'].")"; + }else{ + $li['specname'] = "- 无 -"; + } + if($li['failtime'] > 0){ + $li['failtime'] = date("Y-m-d H:i:s",$li['failtime']); + } + if($li['paytime'] > 0){ + $li['paytime'] = date("Y-m-d H:i:s",$li['paytime']); + } + $li['createtime'] = date("Y-m-d H:i:s",$li['createtime']); + $li['statuscss'] = 'warning'; + $li['statustext'] = '组团中'; + + $li['orderurl'] = web_url("order/wlOrder/orderdetail",array('orderid'=>$li['id'],'type'=>$pluginno)); + } + } + include wl_template('order/checkcodeList'); + } + + + /** + * Comment: 导出核销码列表 + * Author: wlf + * Date: 2019/07/24 16:46 + */ + public function exportCheckcodeList($where,$type){ + global $_W,$_GPC; + if($type == 1){ + $lists = Util::getNumData('orderno,orderid,createtime,mid,status,specid,hexiaotime,hexiaotype,hxuid,checkcode,orderprice,plugin','wlmerchant_smallorder',$where,'id DESC',0,0,0); + $list = $lists[0]; + foreach($list as $k => &$li){ + $member = pdo_get(PDO_NAME.'member',array('id'=>$li['mid']),array('nickname','avatar')); + $li['nickname'] = $member['nickname']; + if($li['specid'] > 0){ + if($li['plugin'] == 'activity'){ + $li['specname'] = pdo_getcolumn(PDO_NAME.'activity_spec',array('uniacid'=>$_W['uniacid'],'id'=>$li['specid']),'name'); + }else { + $li['specname'] = pdo_getcolumn(PDO_NAME . 'goods_option', array('uniacid' => $_W['uniacid'], 'id' => $li['specid']), 'title'); + } + $li['specname'] = $li['specname'] ."(spid:".$li['specid'].")"; + }else{ + $li['specname'] = "- 无 -"; + } + if($li['hexiaotime'] > 0){ + $li['hexiaotime'] = date("Y-m-d H:i:s",$li['hexiaotime']); + } + $li['createtime'] = date("Y-m-d H:i:s",$li['createtime']); + switch ($li['status']){ + case '1': + $li['statustext'] = '待核销'; + break; + case '2': + $li['statustext'] = '已核销'; + break; + case '3': + $li['statustext'] = '已退款'; + break; + case '4': + $li['statustext'] = '申请退款中'; + break; + } + switch ($li['hexiaotype']){ + case '1': + $li['hxtypetext'] = '输码核销'; + break; + case '2': + $li['hxtypetext'] = '扫码核销'; + break; + case '3': + $li['hxtypetext'] = '后台核销'; + break; + case '4': + $li['hxtypetext'] = '密码核销'; + break; + default: + $li['hxtypetext'] = '未核销'; + break; + } + $hxuser = pdo_get(PDO_NAME.'merchantuser',array('id'=>$li['hxuid']),array('name','mid')); + $hxuserimg = pdo_getcolumn(PDO_NAME.'member',array('id'=>$hxuser['mid']),'avatar'); + $li['hxuser'] = $hxuser['name']; + $li['orderno'] = "\t".$li['orderno']."\t"; + } + /* 输出表头 */ + $filter = array( + 'orderno' => '订单编号', + 'specname' => '规格', + 'nickname' => '用户昵称', + 'mid' => '用户MID', + 'checkcode' => '核销码', + 'orderprice' => '订单金额', + 'statustext' => '状态', + 'hexiaotime' => '核销时间', + 'hxtypetext' => '核销方式', + 'hxuser' => '核销员', + 'createtime' => '创建时间', + ); + $data = array(); + for ($i=0; $i < count($list) ; $i++) { + foreach ($filter as $key => $title) { + if(!empty($list[$i][$key])){ + $data[$i][$key] = $list[$i][$key]; + }else{ + $data[$i][$key] = "- 无 -"; + } + } + } + util_csv::export_csv_2($data,$filter, '核销码列表.csv'); + exit; + } + else if($type == 4){ + $list = pdo_fetchall("SELECT a.mid,a.status,a.id,a.paytime,a.orderno,a.specid,a.createtime,a.price,a.num,b.failtime FROM " . tablename(PDO_NAME . "order") + . " as a LEFT JOIN " . tablename(PDO_NAME . "fightgroup_group") + . " as b ON a.fightgroupid = b.id WHERE {$where} "); + + foreach($list as $k => &$li){ + $member = pdo_get(PDO_NAME.'member',array('id'=>$li['mid']),array('nickname','avatar')); + $li['nickname'] = $member['nickname']; + if($li['specid'] > 0){ + $li['specname'] = pdo_getcolumn(PDO_NAME.'goods_option',array('uniacid'=>$_W['uniacid'],'id'=>$li['specid']),'title'); + $li['specname'] = $li['specname'] ."(spid:".$li['specid'].")"; + }else{ + $li['specname'] = "- 无 -"; + } + if($li['failtime'] > 0){ + $li['failtime'] = date("Y-m-d H:i:s",$li['failtime']); + } + if($li['paytime'] > 0){ + $li['paytime'] = date("Y-m-d H:i:s",$li['paytime']); + } + $li['createtime'] = date("Y-m-d H:i:s",$li['createtime']); + $li['statustext'] = '组团中'; + $li['orderno'] = "\t".$li['orderno']."\t"; + } + /* 输出表头 */ + $filter = array( + 'orderno' => '订单编号', + 'specname' => '规格', + 'nickname' => '用户昵称', + 'mid' => '用户MID', + 'num' => '商品数量', + 'price' => '订单金额', + 'statustext' => '状态', + 'paytime' => '支付时间', + 'failtime' => '预计失败时间', + 'createtime' => '下单时间', + ); + $data = array(); + for ($i=0; $i < count($list) ; $i++) { + foreach ($filter as $key => $title) { + if(!empty($list[$i][$key])){ + $data[$i][$key] = $list[$i][$key]; + }else{ + $data[$i][$key] = "- 无 -"; + } + } + } + util_csv::export_csv_2($data,$filter, '组团中订单列表.csv'); + exit; + } + else{ + if($type == 2){ + $list = pdo_fetchall("SELECT a.mid,a.status,a.id,a.paytime,a.orderno,a.optionid,a.createtime,a.actualprice,a.num,b.sendtime,b.receivetime FROM " . tablename(PDO_NAME . "rush_order") + . " as a LEFT JOIN " . tablename(PDO_NAME . "express") + . " as b ON a.expressid = b.id WHERE {$where}"); + + foreach($list as $k => &$li){ + $member = pdo_get(PDO_NAME.'member',array('id'=>$li['mid']),array('nickname','avatar')); + $li['nickname'] = $member['nickname']; + if($li['optionid'] > 0){ + $li['specname'] = pdo_getcolumn(PDO_NAME.'goods_option',array('uniacid'=>$_W['uniacid'],'id'=>$li['optionid']),'title'); + $li['specname'] = $li['specname'] ."(spid:".$li['optionid'].")"; + }else{ + $li['specname'] = "- 无 -"; + } + if($li['sendtime'] > 0){ + $li['sendtime'] = date("Y-m-d H:i:s",$li['sendtime']); + } + if($li['receivetime'] > 0){ + $li['receivetime'] = date("Y-m-d H:i:s",$li['receivetime']); + } + if($li['paytime'] > 0){ + $li['paytime'] = date("Y-m-d H:i:s",$li['paytime']); + } + $li['createtime'] = date("Y-m-d H:i:s",$li['createtime']); + $li['price'] = $li['actualprice']; + switch ($li['status']){ + case '0': + $li['statustext'] = '未支付'; + break; + case '2': + $li['statustext'] = '已收货'; + break; + case '3': + $li['statustext'] = '已收货'; + break; + case '4': + $li['statustext'] = '待收货'; + break; + case '7': + $li['statustext'] = '已退款'; + break; + case '8': + $li['statustext'] = '待发货'; + break; + } + $li['orderno'] = "\t".$li['orderno']."\t"; + } + }else if($type == 3){ + $list = pdo_fetchall("SELECT a.mid,a.status,a.id,a.paytime,a.orderno,a.specid,a.createtime,a.price,a.num,b.sendtime,b.receivetime FROM " . tablename(PDO_NAME . "order") + . " as a LEFT JOIN " . tablename(PDO_NAME . "express") + . " as b ON a.expressid = b.id WHERE {$where} ORDER BY a.id DESC"); + foreach($list as $k => &$li){ + $member = pdo_get(PDO_NAME.'member',array('id'=>$li['mid']),array('nickname','avatar')); + $li['nickname'] = $member['nickname']; + if($li['specid'] > 0){ + $li['specname'] = pdo_getcolumn(PDO_NAME.'goods_option',array('uniacid'=>$_W['uniacid'],'id'=>$li['specid']),'title'); + $li['specname'] = $li['specname'] ."(spid:".$li['specid'].")"; + }else{ + $li['specname'] = "- 无 -"; + } + if($li['sendtime'] > 0){ + $li['sendtime'] = date("Y-m-d H:i:s",$li['sendtime']); + } + if($li['receivetime'] > 0){ + $li['receivetime'] = date("Y-m-d H:i:s",$li['receivetime']); + } + if($li['paytime'] > 0){ + $li['paytime'] = date("Y-m-d H:i:s",$li['paytime']); + } + $li['createtime'] = date("Y-m-d H:i:s",$li['createtime']); + switch ($li['status']){ + case '0': + $li['statustext'] = '未支付'; + break; + case '2': + $li['statustext'] = '已收货'; + break; + case '3': + $li['statustext'] = '已收货'; + break; + case '4': + $li['statustext'] = '待收货'; + break; + case '8': + $li['statustext'] = '待发货'; + break; + } + $li['orderno'] = "\t".$li['orderno']."\t"; + } + } + /* 输出表头 */ + $filter = array( + 'orderno' => '订单编号', + 'specname' => '规格', + 'nickname' => '用户昵称', + 'mid' => '用户MID', + 'num' => '商品数量', + 'price' => '订单金额', + 'statustext' => '状态', + 'paytime' => '支付时间', + 'sendtime' => '发货时间', + 'receivetime' => '收货时间', + 'createtime' => '下单时间', + ); + $data = array(); + for ($i=0; $i < count($list) ; $i++) { + foreach ($filter as $key => $title) { + if(!empty($list[$i][$key])){ + $data[$i][$key] = $list[$i][$key]; + }else{ + $data[$i][$key] = "- 无 -"; + } + } + } + util_csv::export_csv_2($data,$filter, '其他订单列表.csv'); + exit; + } + + } + + /** + * Comment: 预约列表 + * Author: wlf + * Date: 2021/01/07 10:45 + */ + public function appointlist(){ + global $_W,$_GPC; + $pindex = max(1, intval($_GPC['page'])); + $psize = 10; + $where['uniacid'] = $_W['uniacid']; + //条件查询 + if(is_agent()) { + $where['aid'] = $_W['aid']; + } + if(is_store()) { + $where['sid'] = $_W['storeid']; + } + if(!empty($_GPC['plugin'])){ + $where['type'] = $_GPC['plugin']; + } + if($_GPC['status'] != 10){ + $where['status'] = $_GPC['status'] ? : 0; + } + if(!empty($_GPC['keyword'])){ + $keyword = $_GPC['keyword']; + if($_GPC['keywordtype'] == 1){ + $where['orderno@']= trim($keyword); + }else if($_GPC['keywordtype'] == 2){ + $where['sid']= trim($keyword); + }else if($_GPC['keywordtype'] == 3){ + $where['mid']= trim($keyword); + } + } + //时间 + if (!empty($_GPC['time_limit']) && $_GPC['timetype'] ) { + $starttime = strtotime($_GPC['time_limit']['start']); + $endtime = strtotime($_GPC['time_limit']['end']); + if($_GPC['timetype'] == 1){ + $where['appointtime>'] = $starttime; + $where['appointtime<'] = $endtime; + }else{ + $where['starttimestamp>'] = $starttime; + $where['endtimestamp<'] = $endtime; + } + } + if (empty($starttime) || empty($endtime)) { + $starttime = strtotime('-1 month'); + $endtime = time(); + } + + + $appointData = Util::getNumData("*", PDO_NAME . 'appointlist', $where, 'appointtime desc', $pindex, $psize, 1); + $appointlist = $appointData[0]; + $pager = $appointData[1]; + foreach ($appointlist as &$appoint){ + $member = pdo_get('wlmerchant_member',array('id' => $appoint['mid']),array('mobile','nickname','realname')); + if($appoint['type'] == '1'){ + $order = pdo_get('wlmerchant_rush_order',array('id' => $appoint['orderid']),array('sid','blendcredit','activityid','price','expressid','paytype','actualprice','num','optionid')); + $goods = pdo_get('wlmerchant_rush_activity',array('id' => $order['activityid']),array('name','thumb')); + $appoint['goodsprice'] = sprintf("%.2f",$order['price']/$order['num']); + if($order['optionid']){ + $appoint['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$order['optionid']),'title'); + } + $appoint['plugintext'] = '抢购'; + $appoint['plugincss'] = 'success'; + $appoint['goodsid'] = $order['activityid']; + $appoint['ordertype'] = 'a'; + $appoint['detailurl'] = web_url('order/wlOrder/orderdetail',array('orderid'=>$appoint['orderid'],'type'=>1)); + }else if($appoint['type'] == '2'){ + $order = pdo_get('wlmerchant_order',array('id' => $appoint['orderid']),array('sid','blendcredit','fkid','price','expressid','paytype','goodsprice','num','specid')); + $goods = pdo_get('wlmerchant_groupon_activity',array('id' => $order['fkid']),array('name','thumb')); + $appoint['goodsprice'] = sprintf("%.2f",$order['goodsprice']/$order['num']); + if($order['specid']){ + $appoint['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$order['specid']),'title'); + } + $appoint['plugintext'] = '团购'; + $appoint['plugincss'] = 'info'; + $appoint['goodsid'] = $order['fkid']; + $appoint['ordertype'] = 'b'; + $appoint['detailurl'] = web_url('order/wlOrder/orderdetail',array('orderid'=>$appoint['orderid'],'type'=>10)); + }else if($appoint['type'] == '3'){ + $order = pdo_get('wlmerchant_order',array('id' => $appoint['orderid']),array('sid','blendcredit','fkid','price','expressid','paytype','goodsprice','num','specid')); + $goods = pdo_get('wlmerchant_fightgroup_goods',array('id' => $order['fkid']),array('name','logo')); + $appoint['goodsprice'] = sprintf("%.2f",$order['goodsprice']/$order['num']); + if($order['specid']){ + $appoint['optiontitle'] = pdo_getcolumn(PDO_NAME.'goods_option',array('id'=>$order['specid']),'title'); + } + $appoint['plugintext'] = '拼团'; + $appoint['plugincss'] = 'warning'; + $appoint['goodsid'] = $order['fkid']; + $appoint['ordertype'] = 'b'; + $appoint['detailurl'] = web_url('order/wlOrder/orderdetail',array('orderid'=>$appoint['orderid'],'type'=>2)); + }else if($appoint['type'] == '7'){ + $order = pdo_get('wlmerchant_order',array('id' => $appoint['orderid']),array('sid','blendcredit','fkid','price','expressid','paytype','goodsprice','num','specid')); + $goods = pdo_get('wlmerchant_bargain_activity',array('id' => $order['fkid']),array('name','thumb')); + $appoint['goodsprice'] = sprintf("%.2f",$order['goodsprice']/$order['num']); + $appoint['plugintext'] = '砍价'; + $appoint['plugincss'] = 'primary'; + $appoint['goodsid'] = $order['fkid']; + $appoint['ordertype'] = 'b'; + $appoint['detailurl'] = web_url('order/wlOrder/orderdetail',array('orderid'=>$appoint['orderid'],'type'=>12)); + } + $store = pdo_get('wlmerchant_merchantdata',array('id' => $order['sid']),array('storename')); + $appoint['paytype'] = $order['paytype']; + $appoint['nickname'] = $member['nickname']; + $appoint['mobile'] = $member['mobile']; + $appoint['realname'] = $member['realname']; + $appoint['goodsname'] = $goods['name']?$goods['name']:$goods['title']; + $appoint['goodsimg'] = $goods['thumb']?$goods['thumb']:$goods['logo']; + $appoint['storename'] = $store['storename']; + $appoint['num'] = $order['num']; + + + } + + include wl_template('order/appointlist'); + } + + /** + * Comment: 通过预约 + * Author: wlf + * Date: 2021/01/08 14:15 + */ + public function examineAppoint(){ + global $_W,$_GPC; + $id = $_GPC['id']; + if(empty($id)){ + show_json(0, '操作失败,无必要参数请刷新重试'); + } + $appinfo = pdo_get(PDO_NAME.'appointlist',array('id'=>$id),['sorderids','goodid','orderid','mid','type','orderid','num']); + $goodsid = $appinfo['goodid']; + $orderid = $appinfo['orderid']; + $ids = unserialize($appinfo['sorderids']); + switch($appinfo['type']){ + case 1: + $goods = pdo_get('wlmerchant_rush_activity',array('id' => $goodsid),array('uniacid','aid','appointment','name','appointstatus','sid')); + $plugin = 'rush'; + $pluginName = '抢购'; + $goodsName = $goods['name']; + $orderNo = pdo_getcolumn(PDO_NAME.'rush_order',array('id'=>$orderid),'orderno'); + break; + case 2: + $goods = pdo_get('wlmerchant_groupon_activity',array('id' => $goodsid),array('uniacid','appointment','name','aid','appointstatus','sid')); + $plugin = 'groupon'; + $pluginName = '团购'; + $goodsName = $goods['name']; + $orderNo = pdo_getcolumn(PDO_NAME.'order',array('id'=>$orderid),'orderno'); + break; + case 3: + $goods = pdo_get('wlmerchant_fightgroup_goods',array('id' => $goodsid),array('uniacid','name','aid','appointment','appointstatus','sid')); + $plugin = 'wlfightgroup'; + $pluginName = '拼团'; + $goodsName = $goods['name']; + $orderNo = pdo_getcolumn(PDO_NAME.'order',array('id'=>$orderid),'orderno'); + break; + case 7: + $goods = pdo_get('wlmerchant_bargain_activity',array('id' => $goodsid),array('uniacid','name','aid','appointment','appointstatus','sid')); + $plugin = 'bargain'; + $pluginName = '砍价'; + $goodsName = $goods['name']; + $orderNo = pdo_getcolumn(PDO_NAME.'order',array('id'=>$orderid),'orderno'); + break; + } + $res = pdo_update('wlmerchant_appointlist',array('status' => 1),array('id' => $id)); + if($res){ + $upSres = pdo_update('wlmerchant_smallorder',array('appointstatus' => 3),array('id' => $ids)); + if($upSres){ + //发送消息给客户 + $first = '您的'.$pluginName.'订单已经成功预约'; + $type = '订单消费预约'; + $content = '商品名:['.$goodsName.']'; + $newStatus = '预约成功'; + $remark = '订单号:['.$orderNo.'],预约数量:'.$appinfo['num'].'份,点击查看详情'; + $url = h5_url('pages/subPages/orderList/orderDetails/orderDetails' , ['orderid' => $orderid , 'plugin' => $plugin]); + News::jobNotice($appinfo['mid'],$first,$type,$content,$newStatus,$remark,time(),$url); + } + } + show_json(1); + } + + /** + * Comment: 驳回预约 + * Author: wlf + * Date: 2021/01/08 14:25 + */ + public function rejectAppoint(){ + global $_W,$_GPC; + $id = $_GPC['id']; + $reason = $_GPC['reason']; //驳回原因 + if ($_W['ispost']) { + if (empty($id)) { + show_json(0, '操作失败,无必要参数请刷新重试'); + } + if (empty($reason)) { + show_json(0, '请输入驳回原因'); + } + $appinfo = pdo_get(PDO_NAME . 'appointlist', array('id' => $id), ['sorderids','goodid','orderid','mid','type','orderid','num']); + $goodsid = $appinfo['goodid']; + $orderid = $appinfo['orderid']; + $ids = unserialize($appinfo['sorderids']); + switch ($appinfo['type']) { + case 1: + $goods = pdo_get('wlmerchant_rush_activity', array('id' => $goodsid), array('uniacid', 'aid', 'appointment', 'name', 'appointstatus', 'sid')); + $plugin = 'rush'; + $pluginName = '抢购'; + $goodsName = $goods['name']; + $orderNo = pdo_getcolumn(PDO_NAME . 'rush_order', array('id' => $orderid), 'orderno'); + break; + case 2: + $goods = pdo_get('wlmerchant_groupon_activity', array('id' => $goodsid), array('uniacid', 'appointment', 'name', 'aid', 'appointstatus', 'sid')); + $plugin = 'groupon'; + $pluginName = '团购'; + $goodsName = $goods['name']; + $orderNo = pdo_getcolumn(PDO_NAME . 'order', array('id' => $orderid), 'orderno'); + break; + case 3: + $goods = pdo_get('wlmerchant_fightgroup_goods', array('id' => $goodsid), array('uniacid', 'name', 'aid', 'appointment', 'appointstatus', 'sid')); + $plugin = 'wlfightgroup'; + $pluginName = '拼团'; + $goodsName = $goods['name']; + $orderNo = pdo_getcolumn(PDO_NAME . 'order', array('id' => $orderid), 'orderno'); + break; + case 7: + $goods = pdo_get('wlmerchant_bargain_activity', array('id' => $goodsid), array('uniacid', 'name', 'aid', 'appointment', 'appointstatus', 'sid')); + $plugin = 'bargain'; + $pluginName = '砍价'; + $goodsName = $goods['name']; + $orderNo = pdo_getcolumn(PDO_NAME . 'order', array('id' => $orderid), 'orderno'); + break; + } + $res = pdo_update('wlmerchant_appointlist', array('status' => 2, 'reason' => $reason), array('id' => $id)); + if ($res) { + $upSres = pdo_update('wlmerchant_smallorder', array('appointstatus' => 1), array('id' => $ids)); + if ($upSres) { + //发送消息给客户 + $first = '您的' . $pluginName . '订单预约失败'; + $type = '订单消费预约'; + $content = '商品名:[' . $goodsName . ']'; + $newStatus = '预约失败'; + $remark = '驳回原因:[' . $reason . '],点击重新预约'; + $url = h5_url('pages/subPages/orderList/orderDetails/orderDetails', ['orderid' => $orderid, 'plugin' => $plugin]); + News::jobNotice($appinfo['mid'], $first, $type, $content, $newStatus, $remark, time(), $url); + } + } + show_json(1); + } + include wl_template('order/rejectAppoint'); + } + +} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/controller/setting/comment.ctrl.php b/addons/weliam_smartcity/sys/controller/setting/comment.ctrl.php new file mode 100644 index 0000000..517ad80 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/setting/comment.ctrl.php @@ -0,0 +1,27 @@ + referer())); + } + + include wl_template('setting/comment/set'); + } +} diff --git a/addons/weliam_smartcity/sys/controller/setting/pay.ctrl.php b/addons/weliam_smartcity/sys/controller/setting/pay.ctrl.php new file mode 100644 index 0000000..0051807 --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/setting/pay.ctrl.php @@ -0,0 +1,178 @@ + 0){ + foreach($setInfo as $key => &$val){ + //判断微信支付方式是否存在 + $weChat = pdo_getcolumn(PDO_NAME."payment",['id'=>$val['wechat']],'id'); + $val['wechat'] = $weChat > 0 ? $weChat : -1; + //判断支付宝支付方式是否存在 + $aliPay = pdo_getcolumn(PDO_NAME."payment",['id'=>$val['alipay']],'id'); + $val['alipay'] = $aliPay > 0 ? $aliPay : -1; + } + } + + + include wl_template('setting/pay_set'); + } + /** + * Comment: 支付方式列表 + * Author: zzw + * Date: 2019/8/27 15:25 + */ + public function infoList(){ + global $_GPC,$_W; + #1、参数获取 + $name = $_GPC['name'] ? : ''; + #2、获取已保存的设置信息 + $setInfo = Setting::wlsetting_read('payment_set'); + $set = $setInfo[$name]; + #3、获取微信支付方式列表 + $weChat = pdo_getall(PDO_NAME."payment",['uniacid'=>$_W['uniacid'],'type'=>1],['id','name']); + #4、获取支付宝支付方式列表 + $aliPay = pdo_getall(PDO_NAME."payment",['uniacid'=>$_W['uniacid'],'type'=>2],['id','name']); + //云收单支付方式 + if(Customized::init('yunmis160') > 0){ + $yunPay = pdo_getall(PDO_NAME."payment",['uniacid'=>$_W['uniacid'],'type'=>3],['id','name']); + } + #5、定义模块信息 + $plugin = Payment::getBalanceModel(); + //881定制内容 + $isAuth = Customized::init('diy_userInfo'); + + include wl_template('setting/pay_list'); + } + /** + * Comment: 进入支付管理页面 + * Author: zzw + * Date: 2019/8/27 15:26 + */ + public function administration(){ + global $_W,$_GPC; + #1、获取支付设置信息 + $setInfo = Setting::wlsetting_read('payment_set'); + $data = []; + if(is_array($setInfo) && count($setInfo) > 0){ + foreach ($setInfo as $index => $item){ + $data = array_merge($data,array_values($item)); + } + } + //设置商户设置项 + $wxstorepaysetids = pdo_fetchall('select distinct wxallid from ' . tablename(PDO_NAME.'merchantdata')."WHERE uniacid = {$_W['uniacid']}"); + if(is_array($wxstorepaysetids) && count($wxstorepaysetids) > 0){ + foreach ($wxstorepaysetids as $index => $swx){ + $data = array_merge($data,array_values($swx)); + } + } + $appstorepaysetids = pdo_fetchall('select distinct appallid from ' . tablename(PDO_NAME.'merchantdata')."WHERE uniacid = {$_W['uniacid']}"); + if(is_array($appstorepaysetids) && count($appstorepaysetids) > 0){ + foreach ($appstorepaysetids as $index => $sapp){ + $data = array_merge($data,array_values($sapp)); + } + } + //设置代理设置项 + $wxagentpaysetids = pdo_fetchall('select distinct wxpaysetid from ' . tablename(PDO_NAME.'agentusers')."WHERE uniacid = {$_W['uniacid']}"); + if(is_array($wxagentpaysetids) && count($wxagentpaysetids) > 0){ + foreach ($wxagentpaysetids as $index => $awx){ + $data = array_merge($data,array_values($awx)); + } + } + $appagentpaysetids = pdo_fetchall('select distinct apppaysetid from ' . tablename(PDO_NAME.'agentusers')."WHERE uniacid = {$_W['uniacid']}"); + if(is_array($appagentpaysetids) && count($appagentpaysetids) > 0){ + foreach ($appagentpaysetids as $index => $aapp){ + $data = array_merge($data,array_values($aapp)); + } + } + + #1、获取支付列表 + $list = pdo_fetchall("SELECT id,name,type,status,FROM_UNIXTIME(create_time,'%Y-%m-%d %H:%i:%S') as create_time FROM ".tablename(PDO_NAME."payment") + ." WHERE uniacid = {$_W['uniacid']} ORDER BY create_time DESC "); + include wl_template('setting/pay_admin'); + } + /** + * Comment: 编辑支付方式 + * Author: zzw + * Date: 2019/8/28 9:49 + */ + public function editInfo(){ + global $_W,$_GPC; + $id = $_GPC['id'] ? : ''; + if($_W['ispost']){ + #1、参数接收 + $info = $_GPC['info'] ? : []; + $data['uniacid'] = $_W['uniacid']; + $data['name'] = $info['name'];//名称 + $data['type'] = $info['type'];//支付类型1微信支付2支付宝支付 + $data['param'] = json_encode($info);//支付参数 + #2、修改/添加操作 + if($id){ + //id 存在,修改操作 + $res = pdo_update(PDO_NAME."payment",$data,['id'=>$id]); + }else{ + //id 不存在,添加操作 + $data['create_time'] = time(); + $res = pdo_insert(PDO_NAME."payment",$data); + } + #2、判断是否成功 + if($res) wl_json(0,'操作成功'); + else wl_json(1,'操作失败'); + } + + include wl_template('setting/pay_edit'); + } + /** + * Comment: 获取某条支付方式的配置详情 + * Author: zzw + * Date: 2019/8/28 15:03 + */ + public function getInfo(){ + global $_W,$_GPC; + #1、参数获取 + $id = $_GPC['id'] ? : 0; + #2、信息获取 + $info = pdo_get(PDO_NAME."payment",['id'=>$id]); + $params = json_decode($info['param'],true); + + wl_json(0,'信息内容',$params); + } + /** + * Comment: 删除支付方式 + * Author: zzw + * Date: 2019/8/28 14:53 + */ + public function delete(){ + global $_W,$_GPC; + $id = $_GPC['id'] ? : ''; + $res = pdo_delete(PDO_NAME."payment",['id'=>$id]); + if($res) show_json(1,'成功'); + else show_json(0,'删除失败,请重试!'); + } + /** + * Comment: 上传证书 + * Author: zzw + * Date: 2019/8/28 9:50 + */ + public function uploadCertificate(){ + global $_W,$_GPC; + UploadFile::uploadIndex($_FILES,1,0); + } +} diff --git a/addons/weliam_smartcity/sys/controller/setting/payset.ctrl.php b/addons/weliam_smartcity/sys/controller/setting/payset.ctrl.php new file mode 100644 index 0000000..7d4315e --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/setting/payset.ctrl.php @@ -0,0 +1,54 @@ + 0) { + wl_message("上传失败!", '', 'error'); + } else { + if ($cert) { + unlink($_FILES["cert"]["name"]); + $r1 = move_uploaded_file($_FILES["cert"]["tmp_name"], $path . $_FILES["cert"]["name"]); + } else { + $r1 = move_uploaded_file($_FILES["cert"]["tmp_name"], $path . $_FILES["cert"]["name"]); + } + } + } + if (!empty($_FILES["key"]["tmp_name"])) { + if ($_FILES["key"]["error"] > 0) { + wl_message("上传失败!", '', 'error'); + } else { + if ($key) { + unlink($_FILES["key"]["name"]); + $r2 = move_uploaded_file($_FILES["key"]["tmp_name"], $path . $_FILES["key"]["name"]); + } else { + $r2 = move_uploaded_file($_FILES["key"]["tmp_name"], $path . $_FILES["key"]["name"]); + } + } + } + $partner = $_GPC['partner']; + $value = $_GPC['value']; + $p_status = $_GPC['p_status']; + $data1['wechatstatus'] = $_GPC['wechatstatus']; + $data1['status'] = iserializer($p_status); + $data1['value'] = iserializer($value); + $data1['partner'] = iserializer($partner); + Setting::wlsetting_save($data1, 'payset'); + wl_message("提交成功!", '', 'success'); + } + include wl_template('setting/payset'); + } + +} diff --git a/addons/weliam_smartcity/sys/controller/setting/rights.ctrl.php b/addons/weliam_smartcity/sys/controller/setting/rights.ctrl.php new file mode 100644 index 0000000..686e32f --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/setting/rights.ctrl.php @@ -0,0 +1,433 @@ + $value) { + if (empty($id) || !is_numeric($id)) throw new Exception('缺少id参数'); + $price = trim($value['price']); + $content = trim($value['content']); + if ($price < 0 || !is_numeric($price)) throw new Exception('价格不能为负数,且必须为数字'); + $updateArr = ['price' => $price, 'content' => $content]; + $result = pdo_update(PDO_NAME . 'rights', $updateArr, ['id' => $id]); + if ($result === false) throw new Exception('保存失败'); + } + break; + case 1: + case 2: + $temp_specid = ''; + foreach ($data as $specid => $value) { + + if (empty($temp_specid)) $temp_specid = $specid; + + $amount = (int)$value['amount']; + + if (empty($specid) || !is_numeric($specid)) throw new Exception('缺少id参数'); + if ($amount < 0 || !is_numeric($amount)) throw new Exception('个数不能为负数,且必须为数字整形'); + $updateArr = ['amount' => trim($amount)]; + + if (isset($value['date_amount'])) { + $date_amount = (int)$value['date_amount']; + if ($date_amount < 0 || !is_numeric($date_amount)) throw new Exception('天数不能为负数,且必须为数字整形'); + $updateArr['date_amount'] = $date_amount; + } + + $result = pdo_update(PDO_NAME . 'rights_spec', $updateArr, ['id' => $specid]); + if ($result === false) throw new Exception('保存失败'); + } + + if (isset($_GPC['sum_price']) && !empty($temp_specid)) { + $sum_price = trim($_GPC['sum_price']); + if ($sum_price < 0 || !is_numeric($sum_price)) throw new Exception('总价不能为负数,且必须为数字'); + $spec = pdo_get(PDO_NAME . 'rights_spec', ['id' => $temp_specid], ['rights_bagid']); + if ($spec) { + pdo_update(PDO_NAME . 'rights_bag', ['price' => $sum_price], ['id' => $spec['rights_bagid']]); + } + } + break; + } + } catch (Exception $e) { + pdo_rollback(); + wl_message($e->getMessage()); + } + pdo_commit(); + wl_message('设置成功!', web_url('setting/rights/index', array('level' => $level)), 'success'); + } + + public function useRightsIndex() + { + global $_W, $_GPC; + + $levelList = pdo_getall(PDO_NAME . 'rights', ['id' => [1, 5]]); + $_GPC['level'] = $_GPC['level'] ?: 1; + $unit = $_GPC['level'] == 1 ? '天' : '份'; + + $where = ['rightsid' => $_GPC['level']]; + + if (!empty($_GPC['keyword'])) { + $midArr = []; + $keyword = trim($_GPC['keyword']); + if ($_GPC['keywordtype'] == 1) { + $storeUser = pdo_getall(PDO_NAME . 'merchantuser', ['storeid' => $keyword]); + foreach ($storeUser as $user) $midArr[] = $user['mid']; + } else if ($_GPC['keywordtype'] == 2) { + $storeidArr = []; + $storeData = pdo_getall(PDO_NAME . 'merchantdata', " storename like '%{$keyword}%'", ['id']); + foreach ($storeData as $storeVal) $storeidArr[] = $storeVal['id']; + if ($storeidArr) { + $storeUser = pdo_getall(PDO_NAME . 'merchantuser', ['storeid' => $storeidArr]); + foreach ($storeUser as $user) $midArr[] = $user['mid']; + } + } else if ($_GPC['keywordtype'] == 3) { + $midArr[] = $keyword; + } else if ($_GPC['keywordtype'] == 4) { + $member = pdo_getall(PDO_NAME . 'member', " nickname like '%{$keyword}%'", ['id']); + foreach ($member as $memberVal) $midArr[] = $memberVal['id']; + } + if (!empty($midArr)) { + $memberRightsQueryWhere = ['rightsid' => $_GPC['level'], 'mid' => $midArr]; + $memberRightsQuery = pdo_getall(PDO_NAME . 'member_rights', $memberRightsQueryWhere, ['id']); + if ($memberRightsQuery) { + foreach ($memberRightsQuery as $memberRightsVal) $where['member_rightsid'][] = $memberRightsVal['id']; + } else { + $where['id'] = 0; + } + } else { + $where['id'] = 0; + } + } + + if (is_numeric($_GPC['status'])) $where['status'] = $_GPC['status']; + + $pindex = max(1, intval($_GPC['page'])); + $psize = 10; + + $memberData = Util::getNumData("*", PDO_NAME . 'member_rights_use', $where, 'id desc', $pindex, $psize, 1); + $list = $memberData[0]; + $pager = $memberData[1]; + + foreach ($list as &$item) { + + $item['remaining_amount'] = $item['use_total_amount'] - $item['use_amount']; + + $memberRights = pdo_get(PDO_NAME . 'member_rights', ['id' => $item['member_rightsid']]); + $item['mid'] = $memberRights['mid']; + Member::getMemberInfo($item, $memberRights['mid']); + + $storeUser = pdo_get(PDO_NAME . 'merchantuser', ['mid' => $memberRights['mid']], ['storeid']); + if ($storeUser) { + $item['storeid'] = $storeUser['storeid']; + $store = pdo_get(PDO_NAME . 'merchantdata', ['id' => $storeUser['storeid']], ['id', 'storename', 'logo', 'mobile']); + if ($store) { + $item['storename'] = $store['storename']; + $item['logo'] = tomedia($store['logo']); + $item['store_mobile'] = tomedia($store['mobile']); + } + } + + if (!empty($item['start_time'])) $item['start_time'] = date("Y-m-d H:i:s", $item['start_time']); + if (!empty($item['end_time'])) $item['end_time'] = date("Y-m-d H:i:s", $item['end_time']); + + if ($item['rightsid'] == 5) { + $title = pdo_getcolumn(PDO_NAME . 'recruit_recruit',['id' => $item['relation_id']],'title'); + $item['recruit_title'] = $title; + } + } + + include wl_template('setting/rights/useRightsIndex'); + } + + /** + * 开始使用 注:暂时只供广告曝光使用 + * @return void + */ + public function beginRightsUse() + { + global $_W, $_GPC; + + $rightsUseId = $_GPC['id']; + if (empty($rightsUseId)) wl_message('缺少参数ID'); + + $where = ['id' => $rightsUseId, 'status' => 0, 'rightsid' => 1]; + $rightsUse = pdo_get(PDO_NAME . 'member_rights_use', $where, ['id', 'status']); + if (!$rightsUse) wl_message('开始失败,请检查状态是否待开始'); + + $updateData = ['status' => 1, 'start_time' => time()]; + $updateRes = pdo_update(PDO_NAME . 'member_rights_use', $updateData, ['id' => $rightsUse['id']]); + if (!$updateRes) wl_message('开始失败'); + + wl_message('开始成功!', web_url('setting/rights/useRightsIndex', array('level' => $_GPC['level'])), 'success'); + } + + /** + * 手动推送简历 (展示企业需要的简历) + * @return void + */ + public function pushRecruitIndex() + { + global $_W, $_GPC; + + $rightsUseId = $_GPC['id']; + $page = $_GPC['page'] ?: 1; + $pageSize = $_GPC['pageSize'] ?: 20; + + // 用户使用权益信息 + $rightsUse = pdo_get(PDO_NAME . 'member_rights_use', ['id' => $rightsUseId]); + + // 权益类型 + $rights = pdo_get(PDO_NAME . 'rights', ['id' => $rightsUse['rightsid']]); + + // 已推荐简历id(去除已推送过简历) + $resume_where = ''; + $filter = []; + if (!empty($rightsUse['filter'])) { + $filter = unserialize($rightsUse['filter']); + if (!empty($filter['resume_id'])) { + $str = "'" . implode("','", $filter['resume_id']) . "'"; + $resume_where .= " and id not in ({$str})"; + } + } + // 用户权益信息 + $memberRights = pdo_get(PDO_NAME . 'member_rights', ['id' => $rightsUse['member_rightsid']]); + + // 企业招聘信息 + $recruit = pdo_get(PDO_NAME . 'recruit_recruit', ['id' => $rightsUse['relation_id']]); + // 企业信息 + $store = pdo_get(PDO_NAME . 'merchantdata', ['id' => $recruit['release_sid']], ['storename', 'id']); + // 推荐简历查询条件 + $where = ''; + $industryPid = $recruit['industry_pid'] ? : 0;//上级行业id + $industryId = $recruit['industry_id'] ? : 0;//子行业id + $educational = $_GPC['educational_experience'] ? : 0;//最高学历 + $position_id = $recruit['position_id'];//职位id + // 获取行业下面的所有职位 + $positionWhere = []; + if (!empty($industryPid)) $positionWhere['industry_pid'] = $industryPid; + if (!empty($industryId)) $positionWhere['industry_id'] = $industryId; + $positionIdArr = []; + // 查询改简历同行业职位信息 + $positionRes = pdo_getall(PDO_NAME . 'recruit_position',$positionWhere,'id'); + if ($positionRes) { + foreach ($positionRes as $positionRow) $positionIdArr[] = $positionRow['id']; + } + if (!empty($position_id)) $positionIdArr[] = $position_id; + $positionIdArr = array_unique($positionIdArr); + // 获取职位的所有简历信息 + $find_in_set_arr = []; + foreach ($positionIdArr as $positionId) $find_in_set_arr[] = " find_in_set('{$positionId}',expect_position) "; + if ($find_in_set_arr) $where .= implode(" or ",$find_in_set_arr); + if (!empty($recruit['job_type'])) $where .= ($where ? ' and' : '') . " job_type = '{$recruit['job_type']}'"; + + // 推荐简历列表 + $recruit_resume = pdo_getall(PDO_NAME . 'recruit_resume', "{$where} ", '*', '', 'id desc', [$page, $pageSize]); + $graduated_school = '';#毕业院校 + $experience = '';#优先选项 + foreach ($recruit_resume as $key => &$item) { + + // 是否是重点院校内 + if (!empty($filter['graduated_school']) && is_numeric($filter['graduated_school'])) { + $educational_experience = unserialize($item['educational_experience']); + $graduated_school = Rights::$graduatedSchool[$filter['graduated_school']]; + $is_continue = $this->isContinue($graduated_school,$educational_experience,'graduated_school'); + if ($is_continue) { + unset($recruit_resume[$key]); + continue; + } + } + // 优先选项 + if (!empty($filter['experience']) && is_numeric($filter['experience'])) { + $experience = Rights::$experience[$filter['experience']]; + // 是否有在校职务 + if ($filter['experience'] == 1) { + $school_office = unserialize($item['school_office']); + if (empty($school_office)) { + unset($recruit_resume[$key]); + continue; + } + // 是否有在校经历 + } elseif ($filter['experience'] == 2) { + $work_experience = unserialize($item['work_experience']); + if (empty($work_experience)) { + unset($recruit_resume[$key]); + continue; + } + } + } + $item['is_push'] = false; + if (!empty($filter['resume_id']) && in_array($item['id'],$filter['resume_id'])) $item['is_push'] = true; + // 用户头像及昵称 + Member::getMemberInfo($item, $item['mid']); + } + + include wl_template('setting/rights/pushRecruitIndex'); + } + + /** + * 判断是否跳过 + * @param $value + * @param $array + * @param $array_key + * @return bool + */ + protected function isContinue($value,$array,$array_key) + { + if (!$value) return false; + if ($array_key == 'graduated_school' && is_numeric($value)) $value = Rights::$graduatedSchool[$value]; + + if (!is_array($array)) return true; + + $is_continue = true; + foreach ($array as $val) { + if ($value == $val[$array_key]) { + $is_continue = false; + break; + } + } + return $is_continue; + } + + /** + * 推送简历 + * @return void + */ + public function pushRecruit() + { + global $_W, $_GPC; + + $resume_id = $_GPC['id']; + $recruit_id = $_GPC['recruit_id']; + $rights_use_id = $_GPC['rights_use_id']; + if (empty($resume_id)) wl_message('缺少简历ID'); + if (empty($recruit_id)) wl_message('缺少招聘ID'); + if (empty($rights_use_id)) wl_message('缺少权益ID'); + +// $recruit_resume = pdo_get(PDO_NAME . 'recruit_resume',['id' => $resume_id]); + $rightsUseRes = pdo_get(PDO_NAME . 'member_rights_use',['id' => $rights_use_id]); + $rightsid = $rightsUseRes['rightsid']; + $memberRights = pdo_get(PDO_NAME . 'member_rights', ['id' => $rightsUseRes['member_rightsid']]); + $mid = $memberRights['mid']; + +// $submitData = [ +// 'uniacid' => $_W['uniacid'], +// 'mid' => $mid, +// 'resume_id' => $resume_id, +// 'recruit_id' => $recruit_id, +// 'create_time' => time(), +// 'status' => 0 +// ]; +// pdo_insert(PDO_NAME."recruit_submit",$submitData); + + $useRights = Rights::useMemberRights($rightsid,$mid,$recruit_id,'recruit_resume'); + if (!$useRights['status']) wl_message($useRights['msg']); + + $filter = unserialize($rightsUseRes['filter']); + if (empty($filter['resume_id']) || !in_array($resume_id,$filter['resume_id'])) { + $filter['resume_id'][] = $resume_id; + } + + $useRightsUpdate = ['filter' => serialize($filter)]; + pdo_update(PDO_NAME . 'member_rights_use',$useRightsUpdate,['id' => $rights_use_id]); + + wl_message('开始成功!' , web_url('setting/rights/pushRecruitIndex',array('id' => $rights_use_id,'level' => $rightsid)) , 'success'); + } + + /** + * 权益订单管理 + * @return void + */ + public function rightsOrderIndex() + { + global $_W,$_GPC; + //参数信息获取 + $page = $_GPC['page'] ? : 1; + $pageIndex = $_GPC['page_index'] ? : 10; + $startPage = $page * $pageIndex - $pageIndex; + + $where = ['uniacid' => $_W['uniacid'], 'aid' => $_W['aid'], 'plugin' => 'rights']; + + if ($_GPC['rightsid'] == 99) { + $rightsid = $_GPC['rightsid']; + $_GPC['rights_bagid'] = ''; + } + if (!empty($_GPC['rightsid']) && $_GPC['rightsid'] != 99) { + $_GPC['rights_bagid'] = ''; + $rightsid = $_GPC['rightsid']; + $where['fkid'] = $rightsid; + $where['payfor'] = 'rights'; + } + if (!empty($_GPC['rights_bagid'])) { + $_GPC['rightsid'] = ''; + $rights_bagid = $_GPC['rights_bagid']; + $where['fkid'] = $rights_bagid; + $where['payfor'] = 'rightsBag'; + } + + $field = "id,orderno,status,paytype,payfor,paytime,price,fightstatus,fkid,mid"; + $orderData = Util::getNumData($field, PDO_NAME . 'order', $where, 'id desc', $page, $pageIndex, 1); + + $list = $orderData[0]; + $pager = $orderData[1]; + + $rightsList = Rights::getRightsList(); + + foreach($list as $index => &$item){ + if ($item['payfor'] == 'rightsBag') { + + $rightsBag = pdo_get(PDO_NAME . 'rights_bag',['id' => $item['fkid']]); + $item['rights_type'] = $rightsBag['title']; + } else { + $rights = pdo_get(PDO_NAME . 'rights',['id' => $item['fkid']]); + $item['rights_type'] = $rights['rights_type']; + } + + Member::getMemberInfo($item,$item['mid']); + } + + + include wl_template('setting/rights/rightsOrderIndex'); + } +} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/controller/setting/settingTransaction.ctrl.php b/addons/weliam_smartcity/sys/controller/setting/settingTransaction.ctrl.php new file mode 100644 index 0000000..8e07ded --- /dev/null +++ b/addons/weliam_smartcity/sys/controller/setting/settingTransaction.ctrl.php @@ -0,0 +1,46 @@ + +
  • 应用插件库
  • + +
    +
    +
    +
    + {loop $category $ck $cate} + {if !empty($cate['plugins'])} + + {/if} + {/loop} +
    +
    +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/cloud/account.html b/addons/weliam_smartcity/sys/view/default/cloud/account.html new file mode 100644 index 0000000..feda096 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/cloud/account.html @@ -0,0 +1,112 @@ +{php include wl_template('common/header');} +{if $_W['method'] == 'account_list'} +{if empty($_GPC['lct'])} + +{/if} +
    +
    + +
    +
    + {php echo tpl_form_filter_hidden('cloud/plugin/account_list');} + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    如果没有设置公众号权限,默认拥有全部插件权限
    + {if empty($accounts)} +
    +

    还没有相关数据

    +
    + {else} +
    + + + + + + + + + {loop $accounts $account} + + + + + + {/loop} +
    公众号应用权限操作
    {$account['name']} + {loop $account['plugins'] $plugin} + {if $plugins[$plugin]['name']}{$plugins[$plugin]['name']};{/if} + {/loop} + + 编辑 + 删除 +
    +
    +
    + {$pager} +
    + {/if} +
    +
    +{/if} + +{if $_W['method'] == 'account_post'} +{if empty($_GPC['lct'])} + +{/if} +
    +
    +
    +
    公众号权限
    +
    + +
    + +
    +
    +
    + +
    + {loop $plugins $plugin} + + {/loop} +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +{/if} +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/cloud/auth.html b/addons/weliam_smartcity/sys/view/default/cloud/auth.html new file mode 100644 index 0000000..35ad5b4 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/cloud/auth.html @@ -0,0 +1,47 @@ +{php include wl_template('common/header');} + +{if empty($_GPC['lct'])} + +{/if} +
    +
    +
    + +
    +
    授权信息
    +
    + {if empty($auth)} + + {else} +
    +
    产品名称:{$auth['name']}
    +
    平台数量:{$auth['number']}
    +
    最新版本:{$auth['version']}
    +
    +
    +
    授权域名:{$auth['siteurl']}
    +
    授权IP:{$auth['ip']}
    +
    授权码:{$auth['code']}
    +
    +
    +
    授权状态:{$auth['status']}
    +
    到期时间:{$auth['endtime']}
    +
    站点ID:{$auth['siteid']}
    +
    + {/if} +
    +
    +
    +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/cloud/base.html b/addons/weliam_smartcity/sys/view/default/cloud/base.html new file mode 100644 index 0000000..a46e3fa --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/cloud/base.html @@ -0,0 +1,46 @@ +{php include wl_template('common/header');} +{if empty($_GPC['lct'])} + +{/if} +
    +
    +
    +
    +
    基本设置
    +
    +
    + +
    + + 默认:{if Customized::init('distributionText') > 0}门店共享系统{else}智慧城市O2O{/if} +
    +
    +
    + +
    + {php echo attachment_select('logo', $settings['logo']);} + 建议大小190X50 +
    +
    +
    + +
    + + 默认调用公众号名称 +
    +
    +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/cloud/database.html b/addons/weliam_smartcity/sys/view/default/cloud/database.html new file mode 100644 index 0000000..fd8ac2a --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/cloud/database.html @@ -0,0 +1,40 @@ +{php include wl_template('common/header');} +{if empty($_GPC['lct'])} + +{/if} +
    +
    +
    +
    +
    运行SQL语句
    +
    +
    + +
    +
    通过此功能可以直接在数据库中执行特定语句, 用于调试错误. 或者系统管理员特定排错. 注意, 这里运行的语句不会有任何返回结果.
    +
    注意: 此功能可能造成数据破坏, 请谨慎使用. 如果你不清楚他的功能, 请不要使用.
    +
    +
    +
    + +
    + +
    多条语句请使用 ; 隔开
    +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +
    +
    + +{php include wl_template('common/footer');} diff --git a/addons/weliam_smartcity/sys/view/default/cloud/datemana.html b/addons/weliam_smartcity/sys/view/default/cloud/datemana.html new file mode 100644 index 0000000..8ed84a4 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/cloud/datemana.html @@ -0,0 +1,114 @@ +{php include wl_template('common/header');} +{if empty($_GPC['lct'])} + +{/if} +
    +
    + +
    +
    安装地区数据
    +
    +
    + +
    +
    使用前,请先安装地区数据,如您已执行过地区数据可不用重复执行
    +
    +
    +
    + +
    + + +
    +
    +
    +
    + +
    +
    数据更新
    +
    +
    + +
    +
    当您由于缺少字段导致系统错误时,请执行一次数据更新
    + +
    +
    +
    +
    +
    +
    上传修复
    +
    +
    + +
    +
    当您由于代理或商户后台无法上传,显示图片时,请执行一次修复
    + 修复上传 +
    +
    +
    +
    + {if file_exists(PATH_MODULE . 'check.php')} + +
    +
    生成数据库更新文件
    +
    +
    + +
    + {if file_exists(PATH_CORE . "common/dbfile.php")} +
    已生成,最近生成时间:{php echo date('Y-m-d H:i:s', filemtime(PATH_CORE . "common/dbfile.php"))}
    + {else} +
    未生成数据库更新文件
    + {/if} + 生成更新文件 +
    +
    +
    +
    + {/if} +
    +
    +
    +
    + +
    +
    +
    0%
    +
    +
    + 系统正在为您更新数据库,请耐心等待~~~ +
    +
    +
    +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/cloud/jumpadmin.html b/addons/weliam_smartcity/sys/view/default/cloud/jumpadmin.html new file mode 100644 index 0000000..f84dc70 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/cloud/jumpadmin.html @@ -0,0 +1,75 @@ +{php include wl_template('common/header');} +{if empty($_GPC['lct'])} + +{/if} +
    +
    +
    +
    +
    域名跳转
    +
    +
    + +
    +
    + {if empty($settings['targetDmain'])} +
    + + 删除 +
    + {else} + {loop $settings['targetDmain'] $domain} +
    + + 删除 +
    + {/loop} + {/if} +
    + 填入需要被跳转的旧域名,以"/"结尾,如“https://www.baidu.com/”。 +
    +
    + +
    + +
    + + 填入需要跳入的域名,以"/"结尾,如“https://www.baidu.com/”。 +
    +
    +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/cloud/movedata.html b/addons/weliam_smartcity/sys/view/default/cloud/movedata.html new file mode 100644 index 0000000..4f90dd6 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/cloud/movedata.html @@ -0,0 +1,34 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    +
    迁移数据
    +
    +
    + +
    +
    + + + + +
    +
    +
    +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/cloud/plugin.html b/addons/weliam_smartcity/sys/view/default/cloud/plugin.html new file mode 100644 index 0000000..23a445a --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/cloud/plugin.html @@ -0,0 +1,131 @@ +{php include wl_template('common/header');} +{if empty($_GPC['lct'])} + +{/if} +
    +
    + +
    +
    + {php echo tpl_form_filter_hidden('cloud/plugin/index');} + + +
    + +
    +
    + 不限 + {loop $types $key $row} + {$row['name']} + {/loop} +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + {if empty($plugins)} +
    +

    还没有相关数据

    +
    + {else} +
    + + + + + + + + + + + + {loop $plugins $plugin} + + + + + + + + + + {/loop} +
    开关图标标识插件名称插件简介排序
    +
    + + +
    +
    +
    + + +
    +
    {$plugin['name']} + + + + + +
    +
    +
    + + +
    +
    +
    + {/if} +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/cloud/settlement_error.html b/addons/weliam_smartcity/sys/view/default/cloud/settlement_error.html new file mode 100644 index 0000000..b85d444 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/cloud/settlement_error.html @@ -0,0 +1,72 @@ +{php include wl_template('common/header');} + +
    +
    +
    + 累计重复结算金额:¥{php echo $allmoney['allagentmoney'] + $allmoney['alldismoney'] + $allmoney['allstoremoney']},其中商户累计重复结算金额:¥{$allmoney['allstoremoney']},代理累计重复结算金额:¥{$allmoney['allagentmoney']},分销累计重复结算金额:¥{$allmoney['alldismoney']} +
    +
    +
    + {if !empty($lists)} +
    + + + + + + + + + + + + + + + {loop $lists $list} + + + + + + + + + + + {/loop} + +
    订单号 \ 核销码重复总次数 \ 重复总金额商户结算错误金额 \ 商户当前余额 \ 商户名称代理结算错误金额 \ 代理当前余额 \ 代理名称分销结算错误金额一级分销结算错误金额 \ 分销商当前余额 \ 分销商名称二级分销结算错误金额 \ 分销商当前余额 \ 分销商名称操作
    + {$list['orderno']} \ {$list['checkcode']} + + {$list['count']} \ ¥{php echo $list['allstoremoney'] + $list['allagentmoney'] + $list['alldismoney'];} + + ¥{$list['allstoremoney']} \ ¥{$list['nowstoremoney']} \ {$list['storename']} + + ¥{$list['allagentmoney']} \ ¥{$list['nowagentmoney']} \ {$list['agentname']} + + ¥{$list['alldismoney']} + + ¥{$list['oneerrormoney']} \ ¥{$list['onenowmoney']} \ {$list['onedisname']} + + ¥{$list['twoerrormoney']} \ ¥{$list['twonowmoney']} \ {$list['twodisname']} + + 修复结算 +
    +
    +
    +
    +
    +
    +
    +
    + {else} +
    +

    还没有相关数据

    +
    + {/if} +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/cloud/taskcover.html b/addons/weliam_smartcity/sys/view/default/cloud/taskcover.html new file mode 100644 index 0000000..92669df --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/cloud/taskcover.html @@ -0,0 +1,59 @@ +{php include wl_template('common/header');} +{if empty($_GPC['lct'])} + +{/if} +
    +
    +

    {$settings['name']}设置

    +

    计划任务只需设置一次,所有公众号均可使用

    +
    +
    +
    +
    +
    +
    + + +
    +
    + +
    + {if $status==2}{else if $status==3}{else}{/if} +
    +
    + {if $status == 3} +
    + +
    + 重启 +
    +
    + {/if} +
    + +
    + + 不选择任何公众号即对所有公众号生效 +
    +
    +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +{php include wl_template('common/footer');} diff --git a/addons/weliam_smartcity/sys/view/default/cloud/upgrade.html b/addons/weliam_smartcity/sys/view/default/cloud/upgrade.html new file mode 100644 index 0000000..5a0442b --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/cloud/upgrade.html @@ -0,0 +1,107 @@ +{php include wl_template('common/header');} +{if empty($_GPC['lct'])} + +{/if} +
    +
    +
    +
    + {if WELIAM_VERSION == $log['version'] && !empty($log)} + +

    恭喜您,当前系统版本是最新版本!

    + {else} + +

    有新的系统版本更新,是否更新?

    + {/if} +
    当前版本: + {WELIAM_VERSION}最近更新时间:{php echo date('Y-m-d H:i:s', filectime(VERSION_PATH));} +
    + + {if !empty($log)} +
    +

    最新版本:{$log['version']}发布时间:{php echo date('Y-m-d H:i:s', $log['updated_at']);}

    + {php echo htmlspecialchars_decode($log['content']);} +
    + {/if} +
    +
    +
    +
    +
    +
    + +
    +
    +
    0%
    +
    +
    + 系统正在为您更新文件,请耐心等待~~~ +
    +
    +
    +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/cloud/upgrade_log.html b/addons/weliam_smartcity/sys/view/default/cloud/upgrade_log.html new file mode 100644 index 0000000..7ca7204 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/cloud/upgrade_log.html @@ -0,0 +1,61 @@ +{php include wl_template('common/header');} +{if empty($_GPC['lct'])} + +{/if} +
    +
    + {if empty($_GPC['lct'])} +
    更新日志
    + {/if} +
    +
    +

    {{item.day}}

    +

    {{item.year}}

    +
    +
    +
    +
    +
    版本号:{{item.version}}
    +

    {{item.hour}}

    +
    +
    +
    +
    +
    + +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/datacenter/stat_distri.html b/addons/weliam_smartcity/sys/view/default/datacenter/stat_distri.html new file mode 100644 index 0000000..a98c5cf --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/datacenter/stat_distri.html @@ -0,0 +1,343 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + + + + + + + +
    + +
    + + + {php echo tpl_select_time_info('stat_day', array('start' => $selstarttime, 'end' => $selendtime));} + +
    +
    +
    + +
    + +
    +
    +
    + + +
    +
    +
    +
    + +
    +
    +

    总览

    +
    +
    +
    +
    + 佣金总额(元) +
    + +
    +
    +
    + 订单总数 +
    + +
    +
    +
    + 订单总额(元) +
    + +
    +
    +
    + {if Customized::init('distributionText') > 0}共享股东{else}分销商{/if}总人数 +
    + +
    +
    +
    +
    +
    + 抢购佣金 +
    +
    + + ¥-- + + -- +
    +
    + {if p('wlfightgroup')} +
    +
    + 拼团佣金 +
    +
    + + ¥-- + + -- +
    +
    + {/if} + {if p('wlcoupon')} +
    +
    + 卡券佣金 +
    +
    + + ¥-- + + -- +
    +
    + {/if} + {if p('groupon')} +
    +
    + 团购佣金 +
    +
    + + ¥-- + + -- +
    +
    + {/if} + {if p('bargain')} +
    +
    + 砍价佣金 +
    +
    + + ¥-- + + -- +
    +
    + {/if} + {if p('citydelivery')} +
    +
    + 同城配送佣金 +
    +
    + + ¥-- + + -- +
    +
    + {/if} + {if p('pocket')} +
    +
    + 掌上信息佣金 +
    +
    + + ¥-- + + -- +
    +
    + {/if} +
    +
    + 一卡通佣金 +
    +
    + + ¥-- + + -- +
    +
    + {if p('citycard')} +
    +
    + 同城名片佣金 +
    +
    + + ¥-- + + -- +
    +
    + {/if} +
    +
    + 付费入驻佣金 +
    +
    + + ¥-- + + -- +
    +
    +
    +
    + 申请{if Customized::init('distributionText') > 0}共享股东{else}分销商{/if}佣金 +
    +
    + + ¥-- + + -- +
    +
    +
    +
    + +
    +
    +

    柱状图

    +
    +
    +
    +
    +
    + +
    +
    + + + + + + + + {if p('groupon')}{/if} + {if p('wlfightgroup')}{/if} + {if p('wlcoupon')}{/if} + {if p('bargain')}{/if} + {if p('citydelivery')}{/if} + + {if p('pocket')}{/if} + {if p('citycard')}{/if} + + + + + + {loop $list $record} + + + + + + {if p('groupon')}{/if} + {if p('wlfightgroup')}{/if} + {if p('wlcoupon')}{/if} + {if p('bargain')}{/if} + {if p('citydelivery')}{/if} + + {if p('pocket')}{/if} + {if p('citycard')}{/if} + + + + {/loop} + +
    日期订单数总佣金额抢购团购拼团卡券砍价同城配送一卡通掌上信息同城名片付费入驻申请{if Customized::init('distributionText') > 0}共享股东{else}分销商{/if}
    {$record['date']}{$record['ordernum']}¥{$record['dismoney']}¥{$record['rush']}¥{$record['groupon']}¥{$record['fight']}¥{$record['coupon']}¥{$record['bargain']}¥{$record['citydelivery']}¥{$record['half']}¥{$record['pocket']}¥{$record['citycard']}¥{$record['charge']}¥{$record['distri']}
    +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/datacenter/stat_operate.html b/addons/weliam_smartcity/sys/view/default/datacenter/stat_operate.html new file mode 100644 index 0000000..d833d22 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/datacenter/stat_operate.html @@ -0,0 +1,463 @@ +{php include wl_template('common/header');} + + +
    +
    +
    +
    + + + + + + + +
    + +
    + + + {php echo tpl_select_time_info('stat_day', array('start' => $selstarttime, 'end' => $selendtime));} + +
    +
    + {if !is_store()} +
    + +
    + + {if !is_agent()} +
    + +
    + {/if} +
    + +
    +
    +
    + {/if} +
    +
    +
    + +
    +
    +

    总览

    +
    +
    +
    +
    + 营业总额(元) +
    + +
    +
    +
    + 支付客户数 +
    + +
    +
    +
    + 有效订单量 + +
    +
    + + -- + + ¥-- +
    +
    +
    +
    + 退款订单量 +
    +
    + + -- + + ¥-- +
    +
    +
    + {if empty($sid)} +
    + {if p('halfcard')} +
    +
    + 一卡通支付金额 +
    + +
    + {/if} + {if p('pocket')} +
    +
    + 掌上信息支付金额 +
    + +
    + {/if} + {if p('citycard')} +
    +
    + 同城名片支付金额 +
    + +
    + {/if} +
    +
    + 付费入驻支付金额 +
    + +
    + {if p('distribution')} +
    +
    + 分销申请支付金额 +
    + +
    + {/if} + {if !is_agent() && p('consumption')} +
    +
    + 积分兑换支付金额 +
    + +
    + {/if} +
    +
    + 余额充值支付金额 +
    + +
    +
    + {/if} +
    +
    +
    + 抢购支付金额 +
    + +
    + {if p('wlfightgroup')} +
    +
    + 拼团支付金额 +
    + +
    + {/if} + {if p('wlcoupon')} +
    +
    + 卡券支付金额 +
    + +
    + {/if} + {if p('groupon')} +
    +
    + 团购支付金额 +
    + +
    + {/if} + {if p('activity')} +
    +
    + 活动支付金额 +
    + +
    + {/if} +
    +
    + 在线买单 +
    + +
    + {if p('bargain')} +
    +
    + 砍价活动 +
    + +
    + {/if} + {if p('citydelivery')} +
    +
    + 同城配送 +
    + +
    + {/if} +
    +
    + +
    +
    +

    趋势图

    +
    +
    +
    +
    +
    + +
    +
    + + + + + + + {if empty($sid)} + + {if p('pocket')} + + {/if} + {if p('citycard')} + + {/if} + + {if p('distribution')} + + {/if} + + {if !is_agent() && p('consumption')} + + {/if} + {/if} + + {if p('groupon')} + + {/if} + {if p('wlfightgroup')} + + {/if} + {if p('wlcoupon')} + + {/if} + {if p('activity')} + + {/if} + + {if p('bargain')} + + {/if} + {if p('citydelivery')} + + {/if} + + + + + {loop $list $record} + + + + + {if empty($sid)} + + {if p('pocket')}{/if} + {if p('citycard')}{/if} + + {if p('distribution')}{/if} + + {if !is_agent() && p('consumption')} + + {/if} + {/if} + + {if p('groupon')}{/if} + {if p('wlfightgroup')}{/if} + {if p('wlcoupon')}{/if} + {if p('activity')}{/if} + + {if p('bargain')}{/if} + {if p('citydelivery')}{/if} + + + {/loop} + +
    日期订单数总营业额一卡通掌上信息同城名片付费入驻分销商申请余额充值积分兑换抢购团购拼团卡券活动买单砍价同城配送总退款
    {$record['date']}{$record['ordernum']}{$record['allmoney']}¥{$record['half']}¥{$record['pocket']}¥{$record['citycard']}¥{$record['chagre']}¥{$record['dismoney']}¥{$record['recmoney']}¥{$record['consumption']}¥{$record['rush']}¥{$record['groupon']}¥{$record['fight']}¥{$record['coupon']}¥{$record['activity']}¥{$record['payonline']}¥{$record['bargain']}¥{$record['citydelivery']}¥{$record['reordermoney']}
    +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/datacenter/stat_store.html b/addons/weliam_smartcity/sys/view/default/datacenter/stat_store.html new file mode 100644 index 0000000..0d0380c --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/datacenter/stat_store.html @@ -0,0 +1,270 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + {if !is_agent()} + + + + {/if} + + + + +
    + +
    + + + {php echo tpl_select_time_info('stat_day', array('start' => $selstarttime, 'end' => $selendtime));} + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    +
    +

    总览

    +
    +
    +
    +
    + 营业总额(元) +
    + +
    +
    +
    + 总订单 +
    + +
    +
    +
    +
    +
    + 抢购支付金额 +
    +
    + + ¥-- + + -- +
    +
    + {if p('wlfightgroup')} +
    +
    + 拼团支付金额 +
    +
    + + ¥-- + + -- +
    +
    + {/if} + {if p('wlcoupon')} +
    +
    + 卡券支付金额 +
    +
    + + ¥-- + + -- +
    +
    + {/if} + {if p('groupon')} +
    +
    + 团购支付金额 +
    +
    + + ¥-- + + -- +
    +
    + {/if} + {if p('bargain')} +
    +
    + 砍价支付金额 +
    +
    + + ¥-- + + -- +
    +
    + {/if} + {if p('citydelivery')} +
    +
    + 同城配送支付金额 +
    +
    + + ¥-- + + -- +
    +
    + {/if} + {if p('activity')} +
    +
    + 活动支付金额 +
    +
    + + ¥-- + + -- +
    +
    + {/if} +
    +
    + 在线买单金额 +
    +
    + + ¥-- + + -- +
    +
    +
    +
    + +
    +
    +

    趋势图

    +
    +
    +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + +
    排名商户订单量订单量占比营业额营业额占比
    +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/datacenter/stat_store_card.html b/addons/weliam_smartcity/sys/view/default/datacenter/stat_store_card.html new file mode 100644 index 0000000..1118bd4 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/datacenter/stat_store_card.html @@ -0,0 +1,169 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + {if !is_agent()} + + + + {/if} + + + + +
    + +
    + + + {php echo tpl_select_time_info('stat_day', array('start' => date('Y-m-d', $starttime), 'end' => date('Y-m-d', $endtime)));} + +
    +
    +
    +
    +
    + +
    +
    +

    总览

    +
    +
    +
    +
    + 新增商户({$daystext}) +
    + +
    +
    +
    + 总商户数 +
    + +
    +
    +
    + 新增会员({$daystext}) +
    + +
    +
    +
    + 总会员数 +
    + +
    +
    +
    +
    +
    + 付费开通会员({$daystext}) +
    + +
    +
    +
    + 激活码开通会员({$daystext}) +
    + +
    +
    +
    + 实卡开通会员({$daystext}) +
    + +
    +
    +
    + 积分兑换开通会员({$daystext}) +
    + +
    +
    +
    + {if !is_agent()} +
    +
    + + + + + + + + + + + + + +
    代理名称代理地区新增商户({$daystext})总商户数新增会员({$daystext})总会员数
    +
    +
    + {/if} +
    +{if !is_agent()} + +{/if} +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/finace/account.html b/addons/weliam_smartcity/sys/view/default/finace/account.html new file mode 100644 index 0000000..b5ef753 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/finace/account.html @@ -0,0 +1,357 @@ +{php include wl_template('common/header');} +{if $_GPC['type']=='settlement'} + +
    +{if $_GPC['type']=='settlement' && $_GPC['accountType']=='weixin'} +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {if $settlementRecord['type']==1}商户{else}代理{/if}信息申请金额系统提成提现申请时间操作时间状态
    {if $settlementRecord['type']==1}{$settlementRecord['sName']}{else}{$settlementRecord['aName']}{/if}{$settlementRecord['sapplymoney']}元{$settlementRecord['spercent']}% + {if $settlementRecord['type']==1}{/if} + {if $settlementRecord['type']==2}{/if} +
    +
    + {if $settlementRecord['settletype']==1}
    {php echo date('Y-m-d',$settlementRecord['applytime'])}
    {php echo date('H:i:s',$settlementRecord['applytime'])}
    {php echo date('Y-m-d',$settlementRecord['updatetime'])}
    {php echo date('H:i:s',$settlementRecord['updatetime'])}
    {if $settlementRecord['status']==1}{/if} + {if $settlementRecord['status']==2}{/if} + {if $settlementRecord['status']==3}{/if} + {if $settlementRecord['status']==4}{/if} + {if $settlementRecord['status']==5}{/if} + {if $settlementRecord['status']==-1}{/if} + {if $settlementRecord['status']==-2}{/if} +
    +
    +
    +
    +
    +
    +
    +
    结算注意
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    {$settlementRecord['aName']}
    +
    +
    +
    + +
    +
    {$settlementRecord['sName']}
    +
    +
    +
    +

    系统

    +
    +
    + +
    +
    + + % +
    +
    +
    +
    + +
    +
    + + +
    +
    +
    + +
    +

    结算

    +
    +
    + +
    +
    + + +
    +
    +
    +
    + +
    + + + + +
    +
    + +
    +
    +
    + +
    +
    +
    +{/if} +{if $_GPC['type']=='settlement' && $_GPC['accountType']=='f2f'} +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {if $settlementRecord['type']==1}商户{else}代理{/if}信息申请金额系统提成提现申请时间操作时间状态
    {if $settlementRecord['type']==1}{$settlementRecord['sName']}{else}{$settlementRecord['aName']}{/if}{$settlementRecord['sapplymoney']}元{$settlementRecord['spercent']}% + {if $settlementRecord['type']==1}{/if} + {if $settlementRecord['type']==2}{/if} +
    +
    + {if $settlementRecord['settletype']==1}
    {php echo date('Y-m-d',$settlementRecord['applytime'])}
    {php echo date('H:i:s',$settlementRecord['applytime'])}
    {php echo date('Y-m-d',$settlementRecord['updatetime'])}
    {php echo date('H:i:s',$settlementRecord['updatetime'])}
    {if $settlementRecord['status']==1}{/if} + {if $settlementRecord['status']==2}{/if} + {if $settlementRecord['status']==3}{/if} + {if $settlementRecord['status']==4}{/if} + {if $settlementRecord['status']==5}{/if} + {if $settlementRecord['status']==-1}{/if} + {if $settlementRecord['status']==-2}{/if} +
    +
    +
    +
    + +
    +
    {$settlementRecord['aName']}
    +
    +
    + {if $settlementRecord['sName']} +
    + +
    +
    {$settlementRecord['sName']}
    +
    +
    + {/if} +
    + +
    +
    + + % +
    +
    +
    +
    + +
    +
    + + +
    +
    +
    +
    + +
    +
    + + +
    +
    +
    + +
    + +
    + + + + +
    +
    + +
    +
    + +
    +
    +{/if} +{elseif $_GPC['type']=='settlementRecord'} + +
    +
    +
    + + + + + + + + + + + + + {loop $list $item} + + + + + + + + + {/loop} + +
    处理状态结算金额到账金额佣金佣金百分比操作时间
    + {if $item['status']==1}{/if} + {if $item['status']==2}{/if} + {if $item['status']==3}{/if} + {$item['money']}元{$item['get_money']}元{if $item['commission']}{$item['commission']}{else}0.00{/if}{if $item['percent']}{$item['percent']}{else}0.00{/if}%{php echo date("Y-m-d H:i:s",$item['createtime'])}
    +
    +
    + {$pager} +
    +{elseif $_GPC['type'] == 'moneyRecord'} + +
    +
    +
    + + {loop $moneyRecord $item1} + + + + + + + {/loop} +
    {if !empty($item1['order'])} + 订单支付  ID:{$item1['orderid']}
    + {$item1['order']['name']} + {else}商家结算{/if} +
    {if $item1['type']==1}支付成功,总金额 + {elseif $item1['type']==2 || $item['type']==9}发货(核销)成功,可结算金额 + {elseif $item1['type']==3}取消发货(核销),可结算金额 + {elseif $item1['type']==4}商家结算,可结算金额 + {elseif $item1['type']==5}退款,总金额 + {/if}   {if $item1['money']>0}+{/if}{$item1['money']} + + {$item1['detail']}{php echo date("Y-m-d H:i:s",$item1['createtime']);}
    +
    +
    + {$pager} +
    +{/if} +
    +{php include wl_template('common/footer');} diff --git a/addons/weliam_smartcity/sys/view/default/finace/cashApplyAgentRecord.html b/addons/weliam_smartcity/sys/view/default/finace/cashApplyAgentRecord.html new file mode 100644 index 0000000..0add526 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/finace/cashApplyAgentRecord.html @@ -0,0 +1,65 @@ +{php include wl_template('common/header');} + +
    +
    +
    + + + + + + + + + + + + + + {loop $list $merchant} + + + + + + + + + {/loop} + +
    申请信息申请金额系统提成提现申请时间操作时间状态
    代理:{$merchant['aName']}{$merchant['sapplymoney']}元{$merchant['spercent']}% + {if $merchant['type']==2}{/if} +

    {if $merchant['settletype']==1}
    {php echo date('Y-m-d',$merchant['applytime'])}
    {php echo date('H:i:s',$merchant['applytime'])}
    {php echo date('Y-m-d',$merchant['updatetime'])}
    {php echo date('H:i:s',$merchant['updatetime'])}
    {if $merchant['status']==1} + + {elseif $merchant['status']==2} + + {elseif $merchant['status']==3} + + {elseif $merchant['status']==4} + + {elseif $merchant['status']==5} + + {elseif $merchant['status']==-1} + + {/if} +
    + {if empty($list)} +
    + 暂时没有任何数据! +
    + {/if} +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/finace/cashConfirm.html b/addons/weliam_smartcity/sys/view/default/finace/cashConfirm.html new file mode 100644 index 0000000..3629cee --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/finace/cashConfirm.html @@ -0,0 +1,243 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + + + + + + + + +
    + + +
    +
    + + +
    +
    + +
    +
    + {php echo tpl_select_time_info('time', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));} +
    +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + {loop $list $merchant} + + + + + + + + + + + + + + + {/loop} + +
    提现人信息提现类型提现金额申请渠道提现方式手续费到账金额到账类型申请时间操作时间状态操作
    + + {if $merchant['type']==1} + 商家:{$merchant['name']} + {elseif $merchant['type']==2} + 代理:{$merchant['name']} + {elseif $merchant['type']==3} + {if Customized::init('distributionText') > 0}共享股东{else}分销商{/if}:{$merchant['name']} + {elseif $merchant['type']==4} + 用户:{$merchant['name']} + {elseif $merchant['type']==5} + 红娘:{$merchant['name']} + {/if} + + + {if $merchant['type']==1}{/if} + {if $merchant['type']==2}{/if} + {if $merchant['type']==3}{/if} + {if $merchant['type']==4}{/if} + {if $merchant['type']==5}{/if} + {$merchant['sapplymoney']}元 + {if $merchant['source'] == 1} + + {else if $merchant['source'] == 3} + + {else if $merchant['source'] == 2} + + {/if} + + {if $merchant['payment_type'] == 1} + + {elseif $merchant['payment_type'] == 2} + + {elseif $merchant['payment_type'] == 3} +
    +
    + + {elseif $merchant['payment_type'] == 4} +
    + {elseif $merchant['payment_type'] == 5} +
    + {if $merchant['alipay']} +
    + {/if} + {if $merchant['card_number'] && $merchant['bank_name']} +
    +
    + + {/if} + {else} + + + + {/if} +
    {$merchant['spercentmoney']}元{$merchant['sgetmoney']}元 + {if $merchant['settletype']==1 || $merchant['settletype']==3 } + {php echo date('Y-m-d',$merchant['applytime'])}
    {php echo date('H:i:s',$merchant['applytime'])}
    + {if $merchant['updatetime']} + {php echo date('Y-m-d',$merchant['updatetime'])}
    {php echo date('H:i:s',$merchant['updatetime'])} + {/if} +
    + + {if $merchant['status']==1} + + {elseif $merchant['status']==2 || $merchant['status']==6 || $merchant['status']==7 || $merchant['status']==15} + + {elseif $merchant['status']==3 || $merchant['status']==8 || $merchant['status']==16} + + {elseif $merchant['status']==4 || $merchant['status']==5 || $merchant['status']==9 || $merchant['status']==18} + + {elseif $merchant['status']== -1 || $merchant['status']== 10 || $merchant['status']==11 || $merchant['status']==17} + + {/if} + + {if $merchant['status']==2 || $merchant['status']==6 || $merchant['status']==7 || $merchant['status']==15} + 审核通过 + 申请驳回 + {/if} + {if $merchant['status']==3 || $merchant['status']==8 || $merchant['status']==16} + {if $merchant['payment_type'] == 1} + 支付宝打款 + {elseif $merchant['payment_type'] == 2} + 微信打款 + {if $merchant['sgetmoney'] < 200 && $merchant['sgetmoney'] > 1} + 微信红包 + {/if} + {elseif $merchant['payment_type'] == 3} + + {elseif $merchant['payment_type'] == 4} + 余额打款 + {elseif $merchant['payment_type'] == 5} + 微信打款 + {if $merchant['sgetmoney'] < 200 && $merchant['sgetmoney'] > 1} + 微信红包 + {/if} + {if $merchant['alipay']} + 支付宝打款 + {/if} + {if $merchant['card_number'] && $merchant['bank_name']} + + {/if} + {else} + + 微信打款 + {if $merchant['sgetmoney'] < 200 && $merchant['sgetmoney'] > 1} + 微信红包 + {/if} + {/if} + 设为已处理 + {/if} +
    + {if empty($list)} +
    + 暂时没有任何数据! +
    + {/if} +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/finace/cashDetail.html b/addons/weliam_smartcity/sys/view/default/finace/cashDetail.html new file mode 100644 index 0000000..7de6d7a --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/finace/cashDetail.html @@ -0,0 +1,295 @@ +{php include wl_template('common/header');} + + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    申请信息申请金额总提成代理提成
    系统提成
    提现申请时间操作时间状态单数
    {if $settlementRecord['type']==1}商家:{$settlementRecord['sName']}{else}代理:{$settlementRecord['aName']}{/if}{if $settlementRecord['type']==1}{$settlementRecord['sapplymoney']}{else}{$settlementRecord['aapplymoney']}{/if}元{if $settlementRecord['type']==1}{$settlementRecord['spercent']}{else}{$settlementRecord['apercent']}{/if}%{if $settlementRecord['type']==1}{php echo sprintf("%.4f", $settlementRecord['spercent'] - $settlementRecord['apercent'])}%
    {$settlementRecord['apercent']}%{else}0.0000%
    {$settlementRecord['apercent']}%{/if}
    {if $settlementRecord['type']==1}【{if $settlementRecord['type2']==1}超级券{elseif $settlementRecord['type2']==2}拼团{else}抢购{/if}】{/if} + {if $settlementRecord['type']==2}{/if} + {if $settlementRecord['type']==4}{/if} + {if $settlementRecord['type']==3}{/if}

    {if $settlementRecord['settletype']==1}
    {php echo date('Y-m-d',$settlementRecord['applytime'])}
    {php echo date('H:i:s',$settlementRecord['applytime'])}
    {php echo date('Y-m-d',$settlementRecord['updatetime'])}
    {php echo date('H:i:s',$settlementRecord['updatetime'])}
    {if $settlementRecord['status']==1}{/if} + {if $settlementRecord['status']==2}{/if} + {if $settlementRecord['status']==3}{/if} + {if $settlementRecord['status']==4}{/if} + {if $settlementRecord['status']==5}{/if} + {if $settlementRecord['status']==-1}{/if} + {if $settlementRecord['status']==-2}{/if} + + {$settlementRecord['ordernum']} +
    +
    +
    + +
    + +
    +
    + {if $settlementRecord['type']==1} +
    +
    + + + + + + + + + + + + + +
    全选序号商品买家结算状态订单状态金额
    +
    + {loop $list $y $item} +
    + +
    + + + + + + + + + + + + +
    +
    +
    {php echo $y+1}
    +
    + +
    +
    + 商品ID:{$item['id']}
    + {$item['gname']} +
    +
    +
    +
    + {$item['nickname']} + {$item['mobile']} +
    +
    + {if $item['issettlement']==1}待结算{/if} + {if $item['issettlement']==2}已结算{/if} + {if $item['issettlement']==0}未申请{/if} + + {if $item['paytype']==2}微信支付{/if} + {if $item['paytype']==1}余额支付{/if} + + 总额:{$item['price']}
    + 实付:{$item['actualprice']}
    +
    +
    +
    + {/loop} +
    + {/if} + {if $settlementRecord['type']==2} +
    + + + + + + + + + + + + + + + {loop $list $item1} + + + + + + + + + + + {/loop} + +
    用户mid粉丝信息开通时长充值金额所属地区结算状态本次到期时间充值时间
    {$item1['mid']}{$item1['member']['nickname']}
    {$item1['member']['realname']}
    {$item1['member']['mobile']}
    +{$item1['howlong']} 天{$item1['price']}{$item1['areaName']} + {if $item1['issettlement']==0}未申请{/if} + {if $item1['issettlement']==1}待结算{/if} + {if $item1['issettlement']==2}已结算{/if} + {php echo date("Y-m-d",$item1['limittime']);}{php echo date("Y-m-d",$item1['createtime']);}
    +
    + {/if} +{if $settlementRecord['type']==3} +
    +
    + + + + + + + + + + + +
    用户信息用户电话充值时长订单金额结算状态支付时间
    +
    +
    +
    + + + {loop $list $y $item} + + + + + + + + + + + + + + {/loop} + +
    +
    +
    +

    {$item['nickname']}

    +
    +
    + {$item['mobile']} + + {$item['howlong']}天 + + {$item['price']}元 + + {if $item['issettlement']==0}未申请{/if} + {if $item['issettlement']==1}待结算{/if} + {if $item['issettlement']==2}已结算{/if} + + {php echo date('Y-m-d H:i:s',$item['paytime'])} +
    +
    +
    +
    +{/if} +{if $settlementRecord['type'] == 4} +
    +
    + + + + + + + + + + + +
    用户信息用户电话发帖分类订单金额结算状态支付时间
    +
    +
    +
    + + + {loop $list $y $item} + + + + + + + + + + + + + + {/loop} + +
    +
    +
    +

    {$item['nickname']}

    +
    +
    + {$item['mobile']} + + {$item['typename']} + + {$item['price']}元 + + {if $item['issettlement']==0}未申请{/if} + {if $item['issettlement']==1}待结算{/if} + {if $item['issettlement']==2}已结算{/if} + + {php echo date('Y-m-d H:i:s',$item['paytime'])} +
    +
    +
    +
    +{/if} +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/finace/cashSurvey.html b/addons/weliam_smartcity/sys/view/default/finace/cashSurvey.html new file mode 100644 index 0000000..f0d8a95 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/finace/cashSurvey.html @@ -0,0 +1,622 @@ +{php include wl_template('common/header');} + + + +
    +
    +
    + 刷新 + {$time}更新 +
    +
    +
    + + + + + + + + +
    + + +
    +
    + +
    +
    + {php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));} + 查询 +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    总览

    +
    +
    +
    +
    + 订单总额(元) + +
    + +
    +
    +
    + 订单总数 + +
    + +
    +
    +
    + 已完成订单金额 + +
    + +
    +
    +
    + 未完成订单金额 +
    + +
    +
    +
    +
    +
    + 平台佣金收入 + +
    + +
    +
    +
    + 已结算金额 +
    + +
    +
    +
    + 未结算金额 + +
    + +
    +
    +
    + 总退款 +
    + +
    +
    +
    +
    +
    +
    +
    +

    团购

    隐藏 +
    +
    +
    +
    + 订单总额(元) + +
    + +
    + +
    +
    + 已完成订单金额 + +
    + +
    +
    +
    + 未完成订单金额 +
    + +
    +
    +
    +
    +
    +
    +
    +

    抢购

    隐藏 +
    +
    +
    +
    + 订单总额(元) + +
    + +
    +
    +
    + 订单总数 + +
    + +
    +
    +
    + 已完成订单金额 + +
    + +
    +
    +
    + 未完成订单金额 +
    + +
    +
    +
    +
    +
    +
    +
    +

    拼团

    隐藏 +
    +
    +
    +
    + 订单总额(元) + +
    + +
    +
    +
    + 订单总数 + +
    + +
    +
    +
    + 已完成订单金额 + +
    + +
    +
    +
    + 成团数量 +
    + +
    +
    +
    +
    +
    +
    +
    +

    卡券

    隐藏 +
    +
    +
    +
    + 已完成订单金额(元) + +
    + +
    + +
    +
    + 已结算订单金额(元) + +
    + +
    +
    +
    + 已使用卡券总数 +
    + +
    +
    +
    +
    +
    +
    +
    +

    一卡通

    隐藏 +
    +
    +
    +
    + 开通订单金额(元) + +
    + +
    + +
    +
    + 已结算订单金额(元) + +
    + +
    +
    +
    + 一卡通用户数量 + +
    + +
    +
    +
    +
    +
    +
    +
    +

    掌上信息

    隐藏 +
    +
    +
    +
    + 订单金额(元) + +
    + +
    + +
    +
    + 已结算订单金额(元) + +
    + +
    +
    +
    + 掌上信息帖子数量 + +
    + +
    +
    +
    +
    +
    +
    代理与商户全部展开
    +
    + + + + + + + + + + {loop $agents $item} + + + + + + {loop $children[$item['id']] $ccate} + + + + + + {/loop} + {$pager} + {/loop} + + +
    代理名称交易额所占比例
    + + + 商家 + + + + {$item['aMoney']}元 + +
    +
    {$item['forpercent']}%
    +
    +
    +
    + + +
    + +
    + {$ccate['sMoney']}元 + +
    +
    {$ccate['forpercent']}%
    +
    +
    +
    +
    +
    +
    +
    +
    总成交金额:{$allMoney}      最高成交额:{$max}
    +
    +
    + +
    +
    +
    +
    + + + + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/finace/cashrecord.html b/addons/weliam_smartcity/sys/view/default/finace/cashrecord.html new file mode 100644 index 0000000..e505017 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/finace/cashrecord.html @@ -0,0 +1,172 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + + + + + + + +
    + +
    +
    + 全部 + {if p('rush')} + 抢购 + {/if} + {if p('wlfightgroup')} + 拼团 + {/if} + {if p('wlcoupon')} + 卡券 + {/if} + {if !is_store()} + {if p('halfcard')} + 一卡通 + {/if} + {if p('pocket')} + 掌上信息 + {/if} + 付费入驻 + 提现或驳回 + {if p('distribution')} + {if Customized::init('distributionText') > 0}共享股东{else}分销合伙人{/if} + {/if} + {if p('activity')} + 同城活动 + {/if} + {/if} + {if p('groupon')} + 团购 + {/if} + 买单 + {if p('bargain')} + 砍价 + {/if} + {if p('citycard')} + 同城名片 + {/if} + {if p('citydelivery')} + 同城配送 + {/if} + {if p('yellowpage')} + 黄页114 + {/if} + {if p('recruit')} + 求职招聘 + {/if} +
    +
    +
    +
    + +
    + + +
    +
    +
    + +
    + {php echo tpl_select_time_info('time_limit',array('starttime' => date('Y-m-d H:i',$starttime),'endtime' => date('Y-m-d H:i',$endtime)));} +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + + {loop $records $item} + + + + + + + + + + + + {/loop} + +
    订单编号(核销码)订单类型{if !is_agent() && !is_store()}/所属代理{/if}商品信息订单总金额商户收入分销佣金{if p('salesman')}/业务员佣金{/if}{if is_agent()}实际到账{else}代理收入{/if}结算时间操作
    + {$item['orderno']}{if $item['checkcode']}({$item['checkcode']}){/if} + +

    {$item['typename']}

    +

    {$item['agentuser']}

    +
    +

    {$item['title']}

    + {if $item['storename']}

    商家:{$item['storename']}

    {/if} +
    + ¥{$item['orderprice']} + {if $item['specialstatus'] == 1}
    过期订单{/if} +
    + {if $item['merchantmoney']>0}+{/if}{$item['merchantmoney']} + {if $item['merchantnowmoney']>0}
    ({$item['merchantnowmoney']}) {/if} +
    + +{$item['distrimoney']}
    + +{$item['salesmoney']} +
    + {if $item['agentmoney']>0}+{/if}{$item['agentmoney']}
    + ({$item['agentnowmoney']}) +
    + {php echo date('Y-m-d H:i:s',$item['createtime'])} + + 查看订单 +
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/finace/cashset.html b/addons/weliam_smartcity/sys/view/default/finace/cashset.html new file mode 100644 index 0000000..75e38ba --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/finace/cashset.html @@ -0,0 +1,344 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    财务设置
    +
    +
    +
    +
    + +
    +
    + + +
    +
    提现后,商户账户余额必须大于预留金额。
    +
    +
    +
    + +
    +
    + 最小¥ + + 最大¥ + +
    +
    设置为0时,没有金额的大小限制。
    +
    +
    +
    + +
    +
    + + +
    +
    为0天时,则没有间隔时间!
    +
    +
    +
    + +
    + + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + % +
    +
    代理详情中未设置时,会调用这里的默认比例
    +
    +
    +
    + +
    +
    + + % +
    +
    代理详情中未设置时,会调用这里的默认比例
    +
    +
    + {if !empty($isAuth)} +
    + +
    + + +
    服务商分账时微信商户官方提供的分账方式,需要为每个商家、代理单独设置支付子商户,目前微信只开放了低比例分账,请注意平台,代理{if Customized::init('distributionText') > 0}共享股东{else}分销商{/if}分账比例之和不能超过30%,开启此项设置后,如果未设置商户与代理支付项,会按照之前方式结算。
    +
    +
    + {/if} +
    + + +
    + +
    + + +
    开启后,用户可以提现自己的余额。
    +
    +
    + +
    +
    +
    + +
    + + +
    开启后,商户代理提现申请会自动标记为待打款订单。
    +
    +
    +
    + +
    + + +
    开启后,{if Customized::init('distributionText') > 0}共享股东{else}分销{/if}提现申请会自动标记为待打款订单。
    +
    +
    +
    + +
    + + +
    开启后,待打款记录会自动打款给代理,只对实际到账金额大于1元的微信提现和支付宝转账有效
    +
    +
    +
    + +
    + + +
    开启后,待打款记录会自动打款给商家,只对实际到账金额大于1元的微信提现和支付宝转账有效
    +
    +
    +
    + +
    + + +
    开启后,待打款记录会自动打款给{if Customized::init('distributionText') > 0}共享股东{else}分销商{/if},只对实际到账金额大于1元的微信提现,余额提现和支付宝转账有效
    +
    +
    +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    + + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/finace/currentlist.html b/addons/weliam_smartcity/sys/view/default/finace/currentlist.html new file mode 100644 index 0000000..243975f --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/finace/currentlist.html @@ -0,0 +1,182 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + + + + + + + + + +
    + +
    +
    + 全部 + {if p('rush')} + 抢购 + {/if} + {if p('citydelivery')} + 同城配送 + {/if} + {if p('wlfightgroup')} + 拼团 + {/if} + {if p('wlcoupon')} + 卡券 + {/if} + {if p('activity')} + 活动 + {/if} + {if p('groupon')} + 团购 + {/if} + {if !is_store()} + {if p('halfcard')} + 一卡通 + {/if} + {if p('pocket')} + 掌上信息 + {/if} + 付费入驻 + {if p('distribution')} + {if Customized::init('distributionText') > 0}共享股东{else}分销{/if}申请 + {/if} + 提现申请 + {/if} + 后台修改 +
    +
    +
    +
    + +
    + + + {php echo tpl_select_time_info('addtime', array('start' => date('Y-m-d H:i',$starttime), 'end' => date('Y-m-d H:i', $endtime)));} + +
    +
    + {if (!is_agent() || $type != 'agent') && !is_store() } +
    + +
    + {if $type == 'store'} + + {else} + + {/if} +
    +
    + {/if} +
    + +
    + {if (!is_agent() || $type != 'agent') && !is_store() } + + {/if} + + +
    +
    +
    +
    +
    +
    +
    + + + + + {if !is_agent() || $type != 'agent'} + + {/if} + + + + + + + + {loop $records $item} + + + + {if !is_agent() || $type != 'agent'} + + {/if} + + + + + + + + {/loop} + +
    时间账户名称类型收入|支出(元)账户余额详情/备注
    + {php echo date('Y-m-d H:i:s',$item['createtime'])} + + {$item['objname']} + + {$item['typename']} + + {if $item['fee']>0}+{/if}{$item['fee']}
    +
    + {$item['nowmoney']} + + {if $item['type'] == -1 || $item['type'] == 15} + 备注:{$item['remark']} + {else if $item['type'] == 7} + 申请提现或驳回申请 + {else if $item['type'] == 14} + {if is_agent()} + 查看详情 + {else} + 查看详情 + {/if} + {else} + 查看详情 + {/if} +
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/finace/newcashorder.html b/addons/weliam_smartcity/sys/view/default/finace/newcashorder.html new file mode 100644 index 0000000..b7f38af --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/finace/newcashorder.html @@ -0,0 +1,506 @@ +{php include wl_template('common/header');} + + +
    +
    +
    +
    +

    订单信息

    +
    + + + + + + {if $member['mobile']} + + + + + {/if} + {if $order['username']} + + + + + {/if} + {if $order['mobile']} + + + + + {/if} + {if $order['address']} + + + + + {/if} + + + + + {if $order['transid']} + + + + + {/if} + + + + + + + + + + + + + {if $order['checkcode']} + + + + + {/if} + + + + + + + + + {if !empty($moinfo)} + {loop $moinfo $key $mo} + + + + + {/loop} + {/if} +
    下单人微信:{$member['nickname']}
    下单人手机:{$member['mobile']}
    提货人姓名:{$order['username']}
    提货人电话:{$order['mobile']}
    提货人地址:{$order['address']}
    订单编号:{$order['orderno']}
    第三方支付单号:{$order['transid']}
    下单时间:{php echo date('Y-m-d H:i:s', $order['createtime']);}
    订单状态:{$order['statustext']}
    付款方式: + {if !$order['paytype']} + 未支付 + {else} + {$order['paytypetext']}{if $order['paytype'] == 7}(微信{$order['blendwx']}+余额{$order['blendcredit']}){/if} + {/if} +
    订单核销码:{$order['checkcode']}
    买家备注: + {if !empty($order['buyremark'])}{$order['buyremark']}{else}无{/if} +
    卖家备注: + + {if !empty($order['remark'])}{$order['remark']}{else}无{/if} + +
    {$mo['title']}: + {if $mo['id'] == 'text'} + {$mo['data']} + {elseif $mo['id'] == 'textarea'} + + {elseif $mo['id'] == 'select'} + {$mo['data']} + {elseif $mo['id'] == 'checkbox'} + {loop $mo['data'] $moItem} + {$moItem} + {/loop} + {elseif $mo['id'] == 'img'} + {loop $mo['data'] $moItem} + + {/loop} + {elseif $mo['id'] == 'time'} + {$mo['data']} + {elseif $mo['id'] == 'datetime'} + {$mo['data'][0]}~{$mo['data'][1]} + {elseif $mo['id'] == 'city'} + {if is_array($mo['data'])} + {loop $mo['data'] $moItem} + {$moItem} + {/loop} + {else} + {$mo['data']} + {/if} + {/if} +
    +
    +
    +
    +

    订单日志

    +
    + + {loop $logs $log} + + + + {/loop} +
    +

    {php echo date('Y-m-d H:i:s', $log['time']);} {$log['title']}

    +

    + {$log['detail']} +

    + {if !empty($log['thumbs'])} +

    + {loop $log['thumbs'] $logimg} + + {/loop} +

    + {/if} +
    +
    +
    +
    +
    +
    +

    订单费用

    +
    + + + + + + {if $order['packingmoney']>0} + + + + + {/if} + {if $expressprice>0} + + + + + {/if} + {if $vipCardPrice>0} + + + + + {/if} + {if $vipdiscount>0} + + + + + {/if} + {if $dkmoney>0} + + + + + {/if} + {if $fullreducemoney>0} + + + + + {/if} + {if $redpackmoney > 0} + + + + + {/if} + {if $order['issettlement']} + + + + + {if $distrimoney>0} + + + + + {/if} + {if $salesmoney>0} + + + + + {/if} + {if $sharemoney>0} + + + + + {/if} + {/if} + {if $refundmoney>0} + + + + + {/if} + {if $type != 4 && $type != 5 && $type != 6 && $type != 8 && $type != 15} + + + + + {else} + + + + + {/if} + +
    商品价格:+¥ {$goodsprice}
    包装费:+¥{$order['packingmoney']}
    {if $type == 14}配送费{else}快递费{/if}:+¥{$expressprice}
    会员开通:+¥{$vipCardPrice}
    会员减免:-¥{$vipdiscount}
    积分抵扣:-¥{$dkmoney} (花费{$dkcredit}积分)
    满减优惠:-¥{$fullreducemoney}
    红包[{$packname}]:-¥{$redpackmoney}
    代理{if $agentmoney>0}抽佣{else}补贴{/if}:{if $agentmoney>0}-¥{$agentmoney}{else}+¥{php echo abs($agentmoney)}{/if}
    分销抽佣:-¥{$distrimoney}{if $disorder['oneleadid']} (一级:{$onename}¥{$leadmoney['one']} {if $disorder['twoleadid']}二级:{$twoname}¥{$leadmoney['two']} {/if}) {/if}
    业务员抽佣:-¥{$salesmoney} + ({loop $salesarray $sa} + {$sa['nickname']}¥{$sa['salemoney']}, + {/loop}) +
    分享{if $shares['type'] == 1}立减{else}分佣{/if}:-¥{$sharemoney}{if $shares['type'] == 2}(分享人:{$sharename}){/if}
    退款金额 + -¥{$refundmoney} +
    商户实际收入: + {if $order['issettlement'] || ( $order['status'] == 7 && $order['neworderflag']) }¥{$merchantmoney}{else}暂未结算{/if} (本单客户实际支付:¥{$actualprice})
    代理订单 + 本单客户实际支付:¥{$actualprice} +
    +
    +
    +
    +

    商品信息

    +
    + + + + + + + + + + + {if $type == 14} + {loop $delivery_orders $deli} + + + + + + + + {/loop} + {else} + + + + + + {if $editurl} + + {/if} + + {/if} +
    商品规格份数小计(元)
    {$deli['good']['name']}{if !empty($deli['good']['specname'])} {$deli['good']['specname']} {else} 无 {/if}{$deli['num']} 份{$deli['price']} 元 + 商品信息 +
    {if $goods['thumb']} {/if}{$goods['name']}{if !empty($order['optiontitle'])} {$order['optiontitle']} {else} 无 {/if}{$order['num']} 份{$goodsprice} 元 + 商品信息 +
    +
    +
    + {if !empty($smallorders)} +
    +

    核销码信息

    +
    + + + + + + + + + + + + {loop $smallorders $smaa} + + + + + + + + + {/loop} +
    核销码状态金额操作人操作时间操作
    {$smaa['checkcode']} + {if $smaa['status'] == 1} + 待核销 + {else if $smaa['status'] == 2} + 已核销 + {else if $smaa['status'] == 3} + 已退款 + {else if $smaa['status'] == 4} + 申请退款 + {/if} + ¥{$smaa['orderprice']}{$smaa['douser']}{$smaa['dotime']} + {if $smaa['status'] == 1 || $smaa['status'] == 4} + 核销 + - 退款 + {else} + - 无 - + {/if} +
    +
    +
    + {/if} + {if $order['expressid']} +
    +

    快递信息

    +
    + + + + + + + + + + + + + + + + {if $type == 14} + + {else} + + {/if} + +
    买家: {$member['nickname']}  
    配送方式:{if $type == 14}{if $order['fightstatus'] == 1}商家{else if $order['fightstatus'] == 2}平台{/if}配送{else}快递{/if}
    收货人:{$express['address']},{$express['name']},{$express['tel']}  
    + {if $order['status'] == 4} + 修改订单配送信息 + 确认送达 + {/if} + {if $order['status'] == 1} + 确认提货 + {/if} + + 修改订单收货信息 + {if $order['status'] == 8} + 确认发货 + {/if} + {if $order['status'] == 4} + 修改物流 + 取消发货 + 确认收货 + {/if} +
    +
    +
    + {/if} + + {if !empty($afters)} +
    +

    售后信息

    + {loop $afters $aft} +
    + + + + + + + + + + + + + + + + + + {if !empty($aft['checkcodes'])} + + + + + {/if} + {if $aft['status'] == 1} + + + + + {/if} + {if $aft['status'] == 3} + + + + + {/if} + {if $aft['dotime'] > 0} + + + + + {/if} + {if !empty($aft['thumbs'])} + + + + + {/if} +
    申请时间:{php echo date('Y-m-d H:i:s',$aft['createtime'])}
    售后状态:{if $aft['status'] == 1} + 待处理 + {else if $aft['status'] == 2} + 已完成 + {else if $aft['status'] == 3} + 已拒绝 + {else if $aft['status'] == 4} + 用户取消 + {/if} +
    申请原因:{$aft['reason']}
    详细描述:{$aft['detail']}
    售后核销码: + {loop $aft['checkcodes'] $code} + {$code}, + {/loop} +
    操作: + 退款 + - 驳回 +
    驳回原因:{$aft['reply']}
    操作时间:{php echo date('Y-m-d H:i:s',$aft['dotime'])}
    上传图片: + {loop $aft['thumbs'] $img} + + {/loop} +
    +
    + {/loop} +
    + {/if} +
    +
    +
    + + + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/finace/payonlinelist.html b/addons/weliam_smartcity/sys/view/default/finace/payonlinelist.html new file mode 100644 index 0000000..115a13b --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/finace/payonlinelist.html @@ -0,0 +1,101 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + + + + + + +
    + + +
    +
    + +
    + {php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));} +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + {loop $list $de} + + + + + + + + + + + + {/loop} + +
    买单单号用户信息商户信息订单金额不可优惠金额已优惠金额支付金额充值方式充值时间
    {$de['orderno']} {$de['nickname']} {$de['title']}¥{$de['goodsprice']}¥{$de['oprice']}¥{$de['card_fee']}¥{$de['price']} + {if $de['paytype'] == 2} + 微信支付 + {else if $de['paytype'] == 3} + 支付宝 + {else} + {else if $de['paytype'] == 1} + 余额支付 + {else} + {else if $de['paytype'] == 5} + 小程序 + {else} + 其他方式 + {/if} + {$de['paytime']}
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    + + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/finace/refundrecord.html b/addons/weliam_smartcity/sys/view/default/finace/refundrecord.html new file mode 100644 index 0000000..5a340b0 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/finace/refundrecord.html @@ -0,0 +1,135 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + + + + + + + + + +
    + + +
    +
    + + +
    +
    + +
    + +
    +
    +
    + +
    + + +
    +
    +
    + +
    + {php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));} +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + {loop $records $de} + + + + + + + + + + + + + + {/loop} + +
    订单编号(三方单号)用户信息商品信息支付金额支付方式退款金额退款方式退款状态退款备注退款描述退款时间
    {$de['orderno']}{if $de['transid']}
    ({$de['transid']}){/if}
    {$de['nickname']}{$de['goodsname']}
    商户:{$de['storename']}
    ¥{$de['payfee']}{$de['paytype']}¥{$de['refundfee']}{$de['type']} + {if $de['status'] == 1} + 退款成功 + {else} + 退款失败 + {/if} + {$de['remark']}{if $de['errmsg']}{$de['errmsg']}{else}退款成功{/if}{$de['createtime']}
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/balancelist.html b/addons/weliam_smartcity/sys/view/default/member/balancelist.html new file mode 100644 index 0000000..48dcbee --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/balancelist.html @@ -0,0 +1,95 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + + + + + + +
    + +
    +
    + 不限 + 增加 + 减少 +
    +
    +
    +
    + +
    + {php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));} +
    +
    +
    + +
    + + +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + {loop $details $de} + + + + + + + + {/loop} + +
    用户信息变更数值变更类型变更描述变更时间
    {$de['nickname']}¥{$de['num']} + {if $de['num'] > 0} + 增加 + {else} + 减少 + {/if} + {$de['remark']}{$de['createtime']}
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    + + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/campus_activities/commentIndex.html b/addons/weliam_smartcity/sys/view/default/member/campus_activities/commentIndex.html new file mode 100644 index 0000000..4aa3bfe --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/campus_activities/commentIndex.html @@ -0,0 +1,103 @@ +{php include wl_template('common/header');} + +
    +
    + +
    +
    + + + + + + +
    + + +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + {loop $list $row} + + + + + + + + {/loop} + +
    评论人评论信息评论时间状态操作
    + {if $row['avatar']} + + {/if} + {$row['nickname']} + {php echo $row['content'];}{php echo $row['create_time'];} + + {if $row['status']==0} + {elseif $row['status']==1} + {elseif $row['status']==2} + {/if} + + + {if $row['status'] == '0'} + 通过 + 不通过 + {else} + + 删除 + + {/if} +
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/campus_activities/edit.html b/addons/weliam_smartcity/sys/view/default/member/campus_activities/edit.html new file mode 100644 index 0000000..2a8614c --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/campus_activities/edit.html @@ -0,0 +1,66 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + {php echo tpl_diy_editor_create('register[describe]', $register['describe']);} +
    +
    +
    + + +
    + {php echo attachment_select('register[promotional_img]', $register['promotional_img'])} +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/campus_activities/index.html b/addons/weliam_smartcity/sys/view/default/member/campus_activities/index.html new file mode 100644 index 0000000..48ff2fb --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/campus_activities/index.html @@ -0,0 +1,232 @@ +{php include wl_template('common/header');} + + +
    +
    + +
    +
    + + + + + + +
    + +
    + +
    +
    +
    + + +
    +
    + + +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + {loop $list $row} + + + + + + + + + + + + + + + {/loop} + +
    创建人活动标题活动分类活动发布时间宣传海报推荐发布状态驳回原因操作
    + {if $row['avatar']} + + {/if} + {$row['nickname']} + {php echo $row['title'];}{php echo $row['cc_name'];}{if $row['publish_time']}{php echo date('Y-m-d H:i:s',$row['publish_time']);}{/if} + + + + + {php echo tpl_change_status('member/campusActivities/changeRecommend&id='.$row['id'],$row['recommend'])} + + + {if $row['status'] == '0'} + 未发布 + {elseif $row['status'] == '1'} + 已发布 + {elseif $row['status'] == '2'} + 驳回 + {/if} + + + {$row['reject']} + + {if $row['status'] == '0'} + 发布 + {if $row['create_place'] == 2} + 驳回 + {/if} + {/if} + 编辑 + 删除 +
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/check/checkBloggerIndex.html b/addons/weliam_smartcity/sys/view/default/member/check/checkBloggerIndex.html new file mode 100644 index 0000000..49ffab6 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/check/checkBloggerIndex.html @@ -0,0 +1,213 @@ +{php include wl_template('common/header');} +
    +
    +
    +
    + + + + + + +
    + +
    + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + {loop $list $row} + + + + + + + + + + + + {/loop} + +
    微信用户ID微信用户昵称姓名/昵称手机号其他平台粉丝截图申请时间申请状态失败原因操作
    {$row['mid']} + + {php echo $row['nickname'];} + {php echo $row['name'];}{php echo $row['mobile'];} + + + + {php echo $row['create_time'];} + {if $row['status'] == '0'} + + {elseif $row['status'] == '1'} + + {elseif $row['status'] == '2'} + + {/if} + {$row['remark']} + {if empty($row['status'])} + 认证 + {/if} +
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    + + +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/check/checkStudentEdit.html b/addons/weliam_smartcity/sys/view/default/member/check/checkStudentEdit.html new file mode 100644 index 0000000..880bf9e --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/check/checkStudentEdit.html @@ -0,0 +1,69 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + {php echo attachment_select('certificate_img',$data['certificate_img']);} +
    +
    +
    +
    +
    +
    +
    + +
    + + + +
    +
    +
    +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/check/checkStudentIndex.html b/addons/weliam_smartcity/sys/view/default/member/check/checkStudentIndex.html new file mode 100644 index 0000000..f56c665 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/check/checkStudentIndex.html @@ -0,0 +1,223 @@ +{php include wl_template('common/header');} + + +
    +
    +
    +
    + + + + + + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + {loop $list $row} + + + + + + + + + + + + {/loop} + +
    姓名学号手机号学校名称院系名称入学时间学生证件审核状态操作
    {php echo $row['name'];}{php echo $row['code'];}{php echo $row['mobile'];}{php echo $row['school_name'];}{php echo $row['department_name'];}{php echo $row['start_date'];} + +
    + image +
    +
    +
    +
    + {if $row['check_status'] == '0'} + 未审核 + {elseif $row['check_status'] == '1'} + 审核通过 + {elseif $row['check_status'] == '2'} + 审核失败 + {/if} + + {if empty($row['check_status'])} + 审核 + {/if} + 编辑 +
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    + + +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/check/checkTeacherIndex.html b/addons/weliam_smartcity/sys/view/default/member/check/checkTeacherIndex.html new file mode 100644 index 0000000..dc579c6 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/check/checkTeacherIndex.html @@ -0,0 +1,216 @@ +{php include wl_template('common/header');} +
    +
    +
    +
    + + + + + + +
    + +
    + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + {loop $list $row} + + + + + + + + + + + + + + {/loop} + +
    微信用户ID商户姓名手机号学校名称院系教师工作证件申请时间申请状态失败原因操作
    {$row['mid']} + + {php echo $row['nickname'];} + {php echo $row['name'];}{php echo $row['mobile'];}{php echo $row['school_name'];}{php echo $row['faculty'];} + + + + {php echo $row['create_time'];} + {if $row['status'] == '0'} + + {elseif $row['status'] == '1'} + + {elseif $row['status'] == '2'} + + {/if} + {$row['remark']} + {if empty($row['status'])} + 认证 + {/if} +
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    + + +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/im/index.html b/addons/weliam_smartcity/sys/view/default/member/im/index.html new file mode 100644 index 0000000..e47f1fe --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/im/index.html @@ -0,0 +1,142 @@ +{php include wl_template('common/header');} + + +
    + +
    +
    +
    + + + + + + + + +
    + +
    +
    + 用户 + 商户 +
    +
    +
    +
    + +
    +
    + 用户 + 商户 +
    +
    +
    +
    + +
    + + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    +
    + + + + + + + + + + + {loop $list $vo} + + + + + + + {/loop} + +
    发送方接收方最新消息操作
    +
    + +
    +
    +
    {$vo['send_user']}
    + +
    +
    +
    + +
    +
    +
    {$vo['receive_user']}
    + +
    +
    + + + 通信记录 + 清空 + 删除 +
    +
    +
    +
    +
    {$pager}
    +
    +
    +
    +{php include wl_template('common/footer');} diff --git a/addons/weliam_smartcity/sys/view/default/member/im/record.html b/addons/weliam_smartcity/sys/view/default/member/im/record.html new file mode 100644 index 0000000..645c2a7 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/im/record.html @@ -0,0 +1,315 @@ + +
    +
    +
    + +
    +
    + +
    +
    +
    {{ item.date_time }}
    + + +
    {{item.content}}
    + + + + + +
    +
    + +
    +
    +
    +
    {{ item.other.name }}
    +
    {{ item.other.position }}
    +
    +
    {{ item.other.company }} | {{ item.other.branch }}
    +
    +
    个人名片
    +
    + +
    +
    + +
    +
    +
    {{item.other.name}}**
    +
    {{item.other.age}}岁 · {{item.other.experience}} · {{item.other.education}}
    +
    + {{val}} +
    +
    +
    个人简历
    +
    +
    +
    + + +
    +
    +
    + diff --git a/addons/weliam_smartcity/sys/view/default/member/im/set.html b/addons/weliam_smartcity/sys/view/default/member/im/set.html new file mode 100644 index 0000000..d4e574d --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/im/set.html @@ -0,0 +1,147 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    +
    + +
    + + +
    + 普通通信:即旧的通讯方式,仅支持发送文本信息。
    + 多功能通信:新的通讯方式支持文本、表情、图片、视频等等。但是配置复杂,需要修改服务器配置。多功能通信必须配置ssl证书! +
    +
    +
    + +
    +
    + +
    + + 请求时使用的端口。需要在服务器放行 +
    +
    +
    + +
    + +
    公钥在服务器的绝对路径,例如:/www/server/data/ssl/pem.pem
    +
    +
    +
    + +
    + +
    私钥在服务器的绝对路径,例如:/www/server/data/ssl/pem.key
    +
    +
    + {if $set['port'] && $set['key_path'] && $set['pem_path']} +
    + +
    + +
    + + 未链接... + 正在请求,链接中... + 请求成功,通讯中... + 断开链接... + 链接失败,通讯不可用... + 链接失败,当前浏览器不支持WebSocket通讯... +
    +
    +
    + {/if} +
    +
    + +
    + + +
    +
    +
    +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/integrallist.html b/addons/weliam_smartcity/sys/view/default/member/integrallist.html new file mode 100644 index 0000000..c3ed34b --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/integrallist.html @@ -0,0 +1,95 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + + + + + + +
    + +
    +
    + 不限 + 增加 + 减少 +
    +
    +
    +
    + +
    + {php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));} +
    +
    +
    + +
    + + +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + {loop $details $de} + + + + + + + + {/loop} + +
    用户信息变更数值变更类型变更描述变更时间
    {$de['nickname']}{$de['num']} + {if $de['num'] > 0} + 增加 + {else} + 减少 + {/if} + {$de['remark']}{$de['createtime']}
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    + + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/labellist.html b/addons/weliam_smartcity/sys/view/default/member/labellist.html new file mode 100644 index 0000000..d3b87e0 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/labellist.html @@ -0,0 +1,158 @@ +{php include wl_template('common/header');} + +
    +
    +
    + 新建标签 +
    +
    +
    + + + + + + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + {loop $list $item} + + + + + + + + {/loop} + +
    ID标签名称(点击编辑)排序(点击编辑)状态(点击编辑)操作
    {$item['id']} + + {$item['name']} + + + + {$item['sort']} + + + + 3,'value'=>1,'id'=>$item['id']))}' + data-switch-value1='1|启用|label label-primary|{php echo web_url('member/userlabel/changelabel',array('type'=>3,'value'=>0,'id'=>$item['id']))}'> + {if $item['status']==1}启用{else}禁用{/if} + + + + 删除 +
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    + +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/listDetail.html b/addons/weliam_smartcity/sys/view/default/member/listDetail.html new file mode 100644 index 0000000..1556b6e --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/listDetail.html @@ -0,0 +1,162 @@ +{php include wl_template('common/header');} + + +
    +
    +
    +
    +
    +
    用户信息
    +
    + +
    + + {if strexists($member['openid'],'sns_wa')}{/if} + {if strexists($member['openid'],'sns_qq')||strexists($member['openid'],'sns_wx')||strexists($member['openid'],'wap_user')}{/if} + {$member['nickname']} +
    +
    + {if !empty($member['openid'])} +
    + +
    +
    {$member['openid']}
    +
    +
    + {/if} + {if !empty($member['wechat_openid'])} +
    + +
    +
    {$member['wechat_openid']}
    +
    +
    + {/if} + {if !empty($member['unionid'])} +
    + +
    +
    {$member['unionid']}
    +
    +
    + {/if} +
    + +
    +
    {$member['credit1']} + 充值 +
    +
    +
    +
    + +
    +
    {$member['credit2']} + 充值 +
    +
    +
    +
    + +
    +
    {php echo date("Y-m-d H:i:s",$member['createtime'])}
    +
    +
    +
    + +
    +
    + {if empty($member['follow'])} + {if empty($member['unfollowtime'])} + + {else} + + {/if} + {else} + + {/if} +
    +
    +
    + {if p('distribution')} +
    + +
    +
    + {$member['leadname']} + - 修改 +
    +
    +
    + {/if} +
    +
    +
    用户绑定
    +
    以下信息修改后会可能导致用户无法登录WAP端,如需更改请告知该用户!
    +
    + +
    + {php echo tpl_form_field_editor(array('name'=>'data[realname]', 'value'=>$member['realname']))} +
    +
    +
    + +
    + + {if empty($member['mobile'])} + {php echo tpl_form_field_editor(array('name'=>'data[mobile]', 'value'=>$member['mobile']))} + {else} + + {/if} +
    +
    +
    + +
    + {php echo tpl_form_field_editor(array('name'=>'data[password]', 'value'=>''))} +
    密码留空则不修改
    +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/listIndex.html b/addons/weliam_smartcity/sys/view/default/member/listIndex.html new file mode 100644 index 0000000..e9d5701 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/listIndex.html @@ -0,0 +1,275 @@ +{php include wl_template('common/header');} + + +
    +
    +
    +
    + + + + + + + + +
    + +
    + + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + 不限 + {loop $identityList $identityValue} + {$identityValue['name']} + {/loop} +
    +
    +
    +
    + +
    + +
    +
    + {php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d H:i',$starttime), 'endtime' => date('Y-m-d H:i', $endtime)));} +
    +
    +
    + +
    + + + 导入系统粉丝 + 同步用户信息 + 合并重复用户 + {if Customized::init('transfergift') > 0} + + + {/if} +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + {loop $list $row} + + + + + + + + + + + {/loop} + +
    用户手机号积分/余额注册时间成交身份操作
    +
    + + + + + {if empty($row['nickname'])}未授权{else}{php echo base64_decode($row['encodename']);}{/if} + +
    + {if !empty($row['openid'])} + + {/if} + {if !empty($row['wechat_openid'])} + + {/if} +
    +
    +
    +
    + {if !empty($row['mobile'])}{$row['mobile']}{else}--{/if} + 积分 {php echo $row['credit1']} +
    余额 {php echo $row['credit2']} +
    {php echo date("Y-m-d",$row['createtime'])}
    {php echo date("H:i:s",$row['createtime'])}
    订单:{$row['dealnum']} +
    金额:{php echo floatval($row['dealmoney'])} +
    {$row['identity']} + {if $row['is_show_identity']} + {php echo $row['bottom'];} + {/if} + {if $row['identity_id'] == 7} + 权限 + {/if} + {if $row['is_show_identity']} + 成为达人 + {/if} + {if Customized::init('transfergift') > 0} + 批量转赠 + {/if} + {if empty($_W['aid'])} + 客户详情 + {/if} + 客户订单 + {if empty($_W['aid'])} + 账户 + {if empty($row['blackflag'])} + 拉黑 + {else} + 解封 + {/if} + 删除 + {/if} +
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    + +{php include wl_template('common/footer');} diff --git a/addons/weliam_smartcity/sys/view/default/member/listRecharge.html b/addons/weliam_smartcity/sys/view/default/member/listRecharge.html new file mode 100644 index 0000000..e92cd67 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/listRecharge.html @@ -0,0 +1,126 @@ + +
    + + + + + + + + + + + + +
    + \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/memberImport.html b/addons/weliam_smartcity/sys/view/default/member/memberImport.html new file mode 100644 index 0000000..a18abb0 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/memberImport.html @@ -0,0 +1,33 @@ + + \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/membermerge.html b/addons/weliam_smartcity/sys/view/default/member/membermerge.html new file mode 100644 index 0000000..8584b82 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/membermerge.html @@ -0,0 +1,77 @@ + + \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/membersync.html b/addons/weliam_smartcity/sys/view/default/member/membersync.html new file mode 100644 index 0000000..38438c7 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/membersync.html @@ -0,0 +1,33 @@ + + \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/rechargelist.html b/addons/weliam_smartcity/sys/view/default/member/rechargelist.html new file mode 100644 index 0000000..5d7740f --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/rechargelist.html @@ -0,0 +1,86 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + + + + + + +
    + + +
    +
    + +
    + {php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));} +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + {loop $details $de} + + + + + + + + {/loop} + +
    充值单号用户信息充值金额充值方式充值时间
    {$de['orderno']} {$de['nickname']}¥{$de['price']} + {if $de['paytype'] == 2} + 微信支付 + {else if $de['paytype'] == 3} + 支付宝 + {else} + 其他方式 + {/if} + {$de['paytime']}
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    + + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/rightsIndex.html b/addons/weliam_smartcity/sys/view/default/member/rightsIndex.html new file mode 100644 index 0000000..d1ecfed --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/rightsIndex.html @@ -0,0 +1,58 @@ + +
    + + + + + + + + + + + +
    + \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/selectMember.html b/addons/weliam_smartcity/sys/view/default/member/selectMember.html new file mode 100644 index 0000000..c9dbb16 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/selectMember.html @@ -0,0 +1,17 @@ +
    + + + {loop $ds $row} + + + + + {/loop} + {if count($ds)<=0} + + + + {/if} + +
    {$row['nickname']}选择
    未找到
    +
    \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/summary.html b/addons/weliam_smartcity/sys/view/default/member/summary.html new file mode 100644 index 0000000..15d9830 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/summary.html @@ -0,0 +1,96 @@ +{php include wl_template('common/header');} + +
    +
    +
    +

    客户概括

    +
    +
    +
    +
    今日新增(人)
    + +
    +
    +
    昨日新增(人)
    + +
    +
    +
    本月新增(人)
    + +
    +
    +
    总客户(人)
    + +
    +
    +
    +
    +
    +

    客户增长趋势

    +
    +
    + {php echo tpl_select_time_info('time', array('start' => date('Y-m-d', $start),'end' => date('Y-m-d', $end)), '')} +
    +
    +
    +
    +
    +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/transferlist.html b/addons/weliam_smartcity/sys/view/default/member/transferlist.html new file mode 100644 index 0000000..52ad827 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/transferlist.html @@ -0,0 +1,92 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + + + + + + +
    + +
    + {php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));} +
    +
    +
    + +
    + + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + {loop $lists $de} + + + + + + + + + + {/loop} + +
    活动ID活动标题创建者信息金额/总额剩余/总量创建时间操作
    {$de['id']}{$de['title']} + +
    + {$de['nickname']} +
    MID:{$de['mid']} +
    +
    {$de['money']} / {$de['allmoney']}{$de['surplus']} / {$de['allnum']}{php echo date('Y-m-d H:i:s',$de['createtime']);}查看领取记录
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    + + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/transferrecord.html b/addons/weliam_smartcity/sys/view/default/member/transferrecord.html new file mode 100644 index 0000000..b337333 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/transferrecord.html @@ -0,0 +1,90 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + + + + + + +
    + +
    + {php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));} +
    +
    +
    + +
    + + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + {loop $lists $de} + + + + + + + + + + {/loop} + +
    活动ID活动标题领取人信息录入实名录入手机号领取金额领取时间
    {$de['tid']}{$de['title']} + +
    + {$de['nickname']} +
    MID:{$de['mid']} +
    +
    {$de['realname']}{$de['mobile']}{$de['money']}{php echo date('Y-m-d H:i:s',$de['createtime']);}
    +
    +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    + + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/userset.html b/addons/weliam_smartcity/sys/view/default/member/userset.html new file mode 100644 index 0000000..c8e68af --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/userset.html @@ -0,0 +1,165 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    +
    用户设置
    +
    +
    + +
    + + + 启用短信验证可以保证用户所填手机号码的真实性,在用户注册时生效。 +
    +
    +
    + +
    + + + 启用图形验证码能有效防止短信被恶意消耗,在用户注册时生效。 +
    +
    +
    + +
    + {if p('rush')} + + {/if} + {if p('groupon')} + + {/if} + {if p('wlfightgroup')} + + {/if} + {if p('wlcoupon')} + + {/if} + {if p('activity')} + + {/if} + {if p('halfcard')} + + {/if} + {if p('pocket')} + + {/if} + + {if p('distribution')} + + {/if} + {if p('bargain')} + + + {/if} + {if p('consumption')} + + {/if} + {if p('draw')} + + {/if} + + {if p('housekeep')} + + {/if} + {if uniacid_p('dating')} + + {/if} + {if uniacid_p('luckydraw')} + + {/if} +
    +
    +
    + +
    + + + + 几条用户数据同时绑定一个手机号时的处理方式。 +
    +
    +
    + +
    + + 被加入黑名单的用户访问时看到的提示文字。 +
    +
    +
    + +
    + {php echo attachment_select('userset[userbg]', $settings['userbg']);} + 建议图片大小750*500,默认背景参考点击查看 +
    +
    +
    + +
    + {php echo attachment_select('userset[usermainbg]', $settings['usermainbg']);} + 建议图片大小750*520,默认背景参考点击查看 +
    +
    +
    + +
    + {php echo tpl_diy_editor_create('userset[describe]',$settings['describe']);} +
    +
    +
    + +
    + {php echo tpl_diy_editor_create('userset[privacy]',$settings['privacy']);} +
    +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/order/afterlist.html b/addons/weliam_smartcity/sys/view/default/order/afterlist.html new file mode 100644 index 0000000..5690b13 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/order/afterlist.html @@ -0,0 +1,255 @@ +{php include wl_template('common/header');} + + +
    +
    +
    +
    + + + + + + + + +
    + + +
    +
    + +
    +
    + 不限 + 抢购 + {if p('groupon')} + 团购 + {/if} + 拼团 + 卡券 + {if p('bargain')} + 砍价 + {/if} + {if p('activity')} + 活动 + {/if} + {if p('citydelivery')} + 同城配送 + {/if} +
    +
    +
    +
    + +
    + + +
    +
    +
    + +
    + +
    +
    + {php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));} +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    商品
    +
    买家
    +
    商家
    +
    价格/支付
    +
    状态
    +
    操作
    +
    + {loop $afterlist $item} +
    +
    + +
    +
    + + {$item['plugintext']}申请时间:{php echo date('Y-m-d H:i:s',$item['createtime'])} + + 订单编号:{$item['orderno']} + {if $item['type'] == 1} + 要求退款 + {else if $item['type'] == 2} + 要求换货 + {else if $item['type'] == 2} + 要求退货退款 + {/if} +
    +
    + +
    + +
    +
    + +
    +
    +
    + {$item['goodsname']}
    + {if $item['goodsid']>0}ID:{$item['goodsid']}
    {/if} + + {if !empty($item['optiontitle'])}规格:{$item['optiontitle']}{/if} + +
    +
    + + ¥{$item['goodsprice']}
    + x{$item['num']} +
    +
    +
    +
    + +
    +
    + {$item['nickname']} +
    + {$item['realname']}
    {$item['mobile']}
    MID:{$item['mid']} +
    +
    + +
    +
    + {$item['storename']}
    SID:{$item['sid']} +
    +
    + +
    + ¥{$item['orderprice']} + + {if $item['paytype']==1} + 余额支付 + {elseif $item['paytype']==6} + 后台付款 + {elseif $item['paytype']==2} + 微信支付 + {elseif $item['paytype']==3} + 支付宝支付 + {elseif $item['paytype']==5} + 小程序支付 + {elseif $item['paytype']==4} + 货到付款 + {elseif empty($item['paytype']) && $item['actualprice'] == 0 } + 0元购 + {elseif $item['paytype']==7} + 混合支付 + {else} + + {/if} +
    + +
    + {if $item['status'] == 1} + 待处理 + {else if $item['status'] == 2} + 已完成 + {else if $item['status'] == 3} + 已拒绝 + {else if $item['status'] == 4} + 用户取消 + {/if} + {if $item['dotime']} + {php echo date('Y-m-d H:i:s',$item['dotime'])} + {/if} +
    + +
    + {if $item['status'] == 1} + {if !is_store() || $_W['wlsetting']['orderset']['storerefund'] > 0} + 退款 + {/if} + 驳回 + {/if} + {if !empty($item['detailurl'])} + 订单详情 + {/if} +
    +
    +
    + {/loop} +
    + {$pager} +
    +
    +
    +
    +
    +
    +
    + + + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/order/appointlist.html b/addons/weliam_smartcity/sys/view/default/order/appointlist.html new file mode 100644 index 0000000..a9fd97c --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/order/appointlist.html @@ -0,0 +1,218 @@ +{php include wl_template('common/header');} + + +
    +
    +
    +
    + + + + + + + + +
    + + +
    +
    + +
    +
    + 不限 + 抢购 + {if p('groupon')} + 团购 + {/if} + 拼团 + {if p('bargain')} + 砍价 + {/if} +
    +
    +
    +
    + +
    + + +
    +
    +
    + +
    + +
    +
    + {php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));} +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    商品
    +
    买家
    +
    商家
    +
    预约消费时间/数量
    +
    状态
    +
    操作
    +
    + {loop $appointlist $item} +
    +
    + +
    +
    + + {$item['plugintext']}预约申请时间:{php echo date('Y-m-d H:i:s',$item['appointtime'])} + + 订单编号:{$item['orderno']} +
    +
    + +
    + +
    +
    + +
    +
    +
    + {$item['goodsname']}
    + {if $item['goodsid']>0}ID:{$item['goodsid']}
    {/if} + + {if !empty($item['optiontitle'])}规格:{$item['optiontitle']}{/if} + +
    +
    + + ¥{$item['goodsprice']}
    + x{$item['num']} +
    +
    +
    +
    + +
    +
    + {$item['nickname']} +
    + {$item['realname']}
    {$item['mobile']}
    MID:{$item['mid']} +
    +
    + +
    +
    + {$item['storename']}
    SID:{$item['sid']} +
    +
    + +
    + {$item['date']} + {$item['starttime']} ~ {$item['endtime']} + {$item['num']}份 +
    + +
    + {if $item['status'] == 0} + 待处理 + {else if $item['status'] == 1} + 已预约 + {else if $item['status'] == 2} + 已拒绝 + {else if $item['status'] == 3} + 用户取消 + {/if} + {if $item['dotime']} + {php echo date('Y-m-d H:i:s',$item['dotime'])} + {/if} +
    + +
    + {if $item['status'] == 0} + 确认 + 驳回 + {/if} + 订单详情 +
    +
    +
    + {/loop} +
    + {$pager} +
    +
    +
    +
    +
    +
    +
    + + + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/order/changecommission.html b/addons/weliam_smartcity/sys/view/default/order/changecommission.html new file mode 100644 index 0000000..c183f45 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/order/changecommission.html @@ -0,0 +1,45 @@ +
    + + +
    \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/order/changeexpress.html b/addons/weliam_smartcity/sys/view/default/order/changeexpress.html new file mode 100644 index 0000000..f80d3cf --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/order/changeexpress.html @@ -0,0 +1,39 @@ +
    + + +
    \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/order/changeprice.html b/addons/weliam_smartcity/sys/view/default/order/changeprice.html new file mode 100644 index 0000000..40aa62e --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/order/changeprice.html @@ -0,0 +1,48 @@ +
    + + + +
    \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/order/changetime.html b/addons/weliam_smartcity/sys/view/default/order/changetime.html new file mode 100644 index 0000000..5b4a4d3 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/order/changetime.html @@ -0,0 +1,39 @@ +
    + + + +
    \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/order/checkcodeList.html b/addons/weliam_smartcity/sys/view/default/order/checkcodeList.html new file mode 100644 index 0000000..57d536b --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/order/checkcodeList.html @@ -0,0 +1,282 @@ +{php include wl_template('common/header');} + +
    +
    +
    +
    + + + + + + + + + + +
    + +
    + {$goodinfo['name']}(ID:{$id}) +
    +
    +
    + +
    + {$merchant['storename']}(SID:{$goodinfo['sid']}) +
    +
    +
    + +
    +
    + 核销订单 + {if $plugin != 'coupon' && $plugin != 'activity'} + 其他订单 + {/if} + {if $plugin == 'wlfightgroup'} + 组团中订单 + {/if} +
    +
    +
    + {if $type != 3} +
    + + +
    + {/if} +
    + +
    + + +
    +
    +
    + +
    + + {php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));} +
    +
    +
    + +
    + + +
    +
    +
    + +
    +
    共计商品{$tatal}
    +
    +
    +
    +
    +
    +
    + {if $type == 1} +
    + + + + + + + + + + + + + + + + + + {loop $list $de} + + + + + + + + + + + + + + {/loop} + +
    订单编号规格用户信息核销码订单金额状态核销时间核销方式核销员创建时间操作
    {$de['orderno']}{$de['specname']} {$de['nickname']}(MID:{$de['mid']}){$de['checkcode']}¥{$de['orderprice']} + {$de['statustext']} + + {if $de['hexiaotime']>0} + {$de['hexiaotime']} + {else} + - 无 - + {/if} + + {if $de['hexiaotype']>0} + {$de['hxtypetext']} + {else} + - 无 - + {/if} + + {if $de['hxuid']>0} + {$de['hxuser']} + {else} + - 无 - + {/if} + {$de['createtime']}查看订单
    +
    + {else if $type == 2} +
    + + + + + + + + + + + + + + + + + + {loop $list $de} + + + + + + + + + + + + + + {/loop} + +
    订单编号规格用户信息商品数量支付金额状态支付时间发货时间收货时间下单时间操作
    {$de['orderno']}{$de['specname']} {$de['nickname']}(MID:{$de['mid']}){$de['num']}¥{$de['price']} + {$de['statustext']} + + {if $de['paytime']>0} + {$de['paytime']} + {else} + - 无 - + {/if} + + {if $de['sendtime']>0} + {$de['sendtime']} + {else} + - 无 - + {/if} + + {if $de['receivetime']>0} + {$de['receivetime']} + {else} + - 无 - + {/if} + {$de['createtime']}查看订单
    +
    + {else} +
    + + + + + + + + + + + + + + + + + {loop $list $de} + + + + + + + + + + + + + {/loop} + +
    订单编号规格用户信息商品数量支付金额状态支付时间预计失败时间下单时间操作
    {$de['orderno']}{$de['specname']} {$de['nickname']}(MID:{$de['mid']}){$de['num']}¥{$de['price']} + {$de['statustext']} + + {if $de['paytime']>0} + {$de['paytime']} + {else} + - 无 - + {/if} + + {if $de['failtime']>0} + {$de['failtime']} + {else} + - 无 - + {/if} + {$de['createtime']}查看订单
    +
    + {/if} +
    +
    + +
    +
    + {$pager} +
    +
    +
    +
    +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/order/creatfreight.html b/addons/weliam_smartcity/sys/view/default/order/creatfreight.html new file mode 100644 index 0000000..3f917f3 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/order/creatfreight.html @@ -0,0 +1,245 @@ +{php include wl_template('common/header');} + + +
    +
    +
    +
    运费模板
    +
    + +
    + +

    填入文字,便于辨识

    +
    +
    + {if empty($_W['aid']) && !is_store()} +
    + +
    + +
    +
    + {/if} +
    + +
    +
    + 设置运费 +
    +
    +
    +
    +
  • 默认区域
  • +
  • + 下单量 + + 件内,邮费 + + 元,每增加 + + 件,加邮费 + + 元,订单满 + + 件包邮 +
  • +
    +
    + {if $info['expressarray']} + {loop $info['expressarray'] $list} +
    +
    +
  • + 编辑地区 + + - 删除 +
  • +
  • + 下单量 + + 件内,邮费 + + 元,每增加 + + 件,加邮费 + + 元,订单满 + + 件包邮 +
  • +
    +
    + {$list['area']} +
    +
    + {/loop} + {/if} +
    +

    提示:当下单地址不在相应区域内时,会使用默认区域费用。

    +
    +
    +
    + +
    + +
    +
    +
    + +
    + + +
    +
    +
    +
    + {php $areaArray = array('北京','天津','河北','山西','内蒙古自治区','辽宁','吉林','黑龙江','上海','江苏','浙江','安徽','福建','江西','山东','河南','湖北','湖南','广东','广西壮族自治区','海南','重庆','四川','贵州','云南','西藏自治区','陕西','甘肃','青海','宁夏回族自治区','新疆维吾尔自治区','台湾','香港特别行政区','澳门特别行政区','海外')}; + +
    + +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/order/express.html b/addons/weliam_smartcity/sys/view/default/order/express.html new file mode 100644 index 0000000..de5f992 --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/order/express.html @@ -0,0 +1,44 @@ + + +