Commit e06f50ec authored by chenzq's avatar chenzq

待办

parent beed40c6
......@@ -34,8 +34,6 @@ if (function_exists('longbing_check_redis')) {
function getCompanys($good_id){
$sql="SELECT c.id,c.short_name name FROM".tablename('longbing_company_company')." c LEFT JOIN ".tablename('longbing_company_goods_company')." g
ON c.id=g.company_id WHERE g.good_id=$good_id and g.isdel=0 and c.status=1";
......@@ -82,6 +80,12 @@ if ($_GPC['action'] == 'edit') {
}
}
$sta_time = $_GPC['start_time'];
if($sta_time){
$data['start_time']=json_encode($sta_time,true);
}
if (isset($data['images'])) {
$data['images'] = implode(',', $data['images']);
} else {
......
<?php
//dezend by http://www.yunlu99.com/
function checkStaffLimit($uniacid)
{
global $_W;
$list = pdo_getall('longbing_company_user', array('is_staff' => 1, 'uniacid' => $uniacid));
$count = count($list);
$checkExists = pdo_tableexists('longbing_companyauth2_default');
if ($checkExists) {
$auth_info = pdo_get('longbing_companyauth2_default');
if ($auth_info && $auth_info['card_number']) {
if ($auth_info['card_number'] <= $count) {
return true;
}
return false;
}
}
$checkExists = pdo_tableexists('user_jump');
if ($checkExists) {
$jump_user = $jump = pdo_get('user_jump', array('username' => $_W['username'], 'uniacid' => $uniacid));
if ($jump_user && $jump_user['card_num']) {
if ($jump_user['card_num'] <= $count) {
return true;
}
return false;
}
}
if (LONGBING_AUTH_CARD && LONGBING_AUTH_CARD <= $count) {
return true;
}
return false;
}
function changeCollction($id, $type)
{
global $_GPC;
global $_W;
$info = pdo_get('longbing_company_collection', array('uid' => $id, 'to_uid' => $id, 'uniacid' => $_W['uniacid']));
if ($type == 1) {
if (!$info) {
@pdo_insert('longbing_company_collection', array('uniacid' => $_W['uniacid'], 'uid' => $id, 'to_uid' => $id, 'create_time' => time(), 'update_time' => time()));
} else {
pdo_update('longbing_company_collection', array('status' => 1, 'update_time' => time()), array('to_uid' => $id));
}
} else if (empty($info)) {
} else {
pdo_update('longbing_company_collection', array('status' => 0, 'update_time' => time()), array('to_uid' => $id));
}
}
function createQr3($image, $path, $uniacid)
{
global $_GPC;
global $_W;
if (!is_dir(ATTACHMENT_ROOT . '/' . 'images')) {
mkdir(ATTACHMENT_ROOT . '/' . 'images');
}
if (!is_dir(ATTACHMENT_ROOT . '/' . 'images/longbing_company')) {
mkdir(ATTACHMENT_ROOT . '/' . 'images/longbing_company');
}
if (!is_dir(ATTACHMENT_ROOT . '/' . ('images/longbing_company/' . $_W['uniacid'] . '/'))) {
mkdir(ATTACHMENT_ROOT . '/' . ('images/longbing_company/' . $_W['uniacid'] . '/'));
}
$appid = $_W['account']['key'];
$appsecret = $_W['account']['secret'];
$access_token = getAccessToken2();
if (!$access_token) {
return false;
}
$url = 'https://api.weixin.qq.com/wxa/getwxacode?access_token=' . $access_token;
$postData = array('path' => $path);
$postData = json_encode($postData);
$response = ihttp_post($url, $postData);
$content = json_decode($response['content'], true);
if (isset($content['errcode'])) {
return $content;
}
if (200 < strlen($response['content'])) {
$res = file_put_contents($image, $response['content']);
return true;
}
return false;
}
function getAccessToken2()
{
global $_GPC;
global $_W;
$appid = $_W['account']['key'];
$appsecret = $_W['account']['secret'];
$appidMd5 = md5($appid);
if (!is_file(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt')) {
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret;
$data = ihttp_get($url);
$data = json_decode($data['content'], true);
if (!isset($data['access_token'])) {
return false;
}
$access_token = $data['access_token'];
file_put_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt', json_encode(array('at' => $access_token, 'time' => time() + 6200)));
return $access_token;
}
if (is_file(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt')) {
$fileInfo = file_get_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt');
if (!$fileInfo) {
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret;
$data = ihttp_get($url);
$data = json_decode($data['content'], true);
if (!isset($data['access_token'])) {
return false;
}
$access_token = $data['access_token'];
file_put_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt', json_encode(array('at' => $access_token, 'time' => time() + 6200)));
return $access_token;
}
$fileInfo = json_decode($fileInfo, true);
if ($fileInfo['time'] < time()) {
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret;
$data = ihttp_get($url);
$data = json_decode($data['content'], true);
if (!isset($data['access_token'])) {
return false;
}
$access_token = $data['access_token'];
file_put_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt', json_encode(array('at' => $access_token, 'time' => time() + 6200)));
return $access_token;
}
return $fileInfo['at'];
}
return false;
}
global $_GPC;
global $_W;
define('ROOT_PATH', IA_ROOT . '/addons/longbing_company/');
is_file(ROOT_PATH . '/inc/we7.php') || exit('Access Denied Longbing');
require_once ROOT_PATH . '/inc/we7.php';
$uniacid = $_W['uniacid'];
$module_name = $_W['current_module']['name'];
$redis_sup_v3 = false;
$redis_server_v3 = false;
include_once $_SERVER['DOCUMENT_ROOT'] . '/addons/longbing_company/images/phpqrcode/func_longbing.php';
if (function_exists('longbing_check_redis')) {
$config = $_W['config']['setting']['redis'];
$password = '';
if ($config && isset($config['requirepass']) && $config['requirepass']) {
$password = $config['requirepass'];
}
if ($config && isset($config['server']) && $config['server'] && isset($config['port']) && $config['port']) {
list($redis_sup_v3, $redis_server_v3) = longbing_check_redis($config['server'], $config['port'], $password);
}
}
$time = time();
if ($_GPC['action'] == 'addStaff') {
$check_res = checkstafflimit($_W['uniacid']);
if ($check_res) {
message('创建名片达到上限' . ', 如需增加请购买高级版本', '', 'error');
}
$checkExists = pdo_tableexists('longbing_companyauth2_config');
if ($checkExists) {
$auth_info = pdo_get('longbing_companyauth2_config', array('modular_id' => $_W['uniacid']));
if ($auth_info) {
$list = pdo_getall('longbing_company_user', array('is_staff' => 1, 'uniacid' => $_W['uniacid']));
$count = count($list);
if ($auth_info['end_time'] < $time) {
message('授权已到期, 请联系管理员', '', 'error');
}
if ($auth_info['number'] <= $count) {
message('创建名片上限为: ' . $auth_info['number'] . ', 如需增加请联系管理员', '', 'error');
}
}
}
$user = pdo_get('longbing_company_user', array('id' => $_GPC['id']));
if (!$user) {
message('未找到用户', '', 'error');
}
if ($user['is_staff'] == 1) {
message('该用户已经是员工了', '', 'error');
}
if ($user['is_stock'] == 1 && $_GPC['is_stock']) {
message('该用户已经是股东了', '', 'error');
}
if ($_GPC['is_stock']) {
$where = array('update_time' => $time, 'is_staff' => 1, 'is_stock' => 1);
} else {
$where = array('update_time' => $time, 'is_staff' => 1);
}
$user = pdo_get('longbing_company_user_info', array('fans_id' => $_GPC['id']));
pdo_update('longbing_company_user', $where, array('id' => $_GPC['id']));
if (!$user || empty($user)) {
$result = pdo_insert('longbing_company_user_info', array('fans_id' => $_GPC['id'], 'create_time' => $time, 'update_time' => $time, 'is_staff' => 1, 'status' => 1, 'uniacid' => $_W['uniacid'], 'is_default' => 1));
if ($result) {
changecollction($_GPC['id'], 1);
message('添加成功', $this->createWebUrl('manage/users'), 'success');
}
}
$result = pdo_update('longbing_company_user_info', array('status' => 1, 'is_staff' => 1, 'is_default' => 1, 'update_time' => time()), array('fans_id' => $_GPC['id']));
if ($result) {
changecollction($_GPC['id'], 1);
if ($redis_sup_v3) {
$redis_server_v3->flushDB();
message('设置成功2', $this->createWebUrl('manage/users'), 'success');
}
message('添加成功', $this->createWebUrl('manage/users'), 'success');
}
message('添加失败', '', 'error');
}
if ($_GPC['action'] == 'addPermission') {
$user = pdo_get('longbing_company_user', array('id' => $_GPC['id']));
if (!$user) {
message('未找到用户', '', 'error');
}
if ($user['is_staff'] != 1) {
message('该用户还不是员工', '', 'error');
}
$result = pdo_update('longbing_company_user', array('status' => 1, 'is_staff' => 1, 'update_time' => time(), 'permission' => 1), array('id' => $_GPC['id']));
if ($result) {
if ($redis_sup_v3) {
$redis_server_v3->flushDB();
message('设置成功2', $this->createWebUrl('manage/permission'), 'success');
}
message('设置成功', $this->createWebUrl('manage/permission'), 'success');
}
message('设置失败', '', 'error');
}
if ($_GPC['action'] == 'delPermission') {
$user = pdo_get('longbing_company_user', array('id' => $_GPC['id']));
if (!$user) {
message('未找到用户', '', 'error');
}
if ($user['is_staff'] != 1) {
message('该用户还不是员工', '', 'error');
}
$result = pdo_update('longbing_company_user', array('status' => 1, 'permission' => 0, 'update_time' => time()), array('id' => $_GPC['id']));
if ($result) {
if ($redis_sup_v3) {
$redis_server_v3->flushDB();
message('设置成功2', $this->createWebUrl('manage/permission'), 'success');
}
message('设置成功', $this->createWebUrl('manage/permission'), 'success');
}
message('设置失败', '', 'error');
}
$limit = array(1, 15);
$where = array(
'uniacid' => $_W['uniacid'],
'is_staff'=>1
);
$curr = 1;
$id_arr = array();
$users_search = array();
if (isset($_GPC['keyword']) && $_GPC['keyword']) {
$keyword = $_GPC['keyword'];
$where['nickName like'] = '%' . $_GPC['keyword'] . '%';
$infos = pdo_getall('longbing_company_user_info', array('uniacid' => $_W['uniacid'], 'name like' => '%' . $_GPC['keyword'] . '%'));
foreach ($infos as $index => $item) {
array_push($id_arr, $item['fans_id']);
}
if (!empty($id_arr)) {
$users_search = pdo_getall('longbing_company_user', array('uniacid' => $_W['uniacid'], 'id in' => $id_arr));
if(!empty($users_search)){
$company = pdo_getall('longbing_company_company', array('uniacid' => $_W['uniacid'], 'name like' => '%' . $_GPC['keyword'] . '%'));
}
}
}
if (isset($_GPC['page'])) {
$limit[0] = $_GPC['page'];
$curr = $_GPC['page'];
}
$users = pdo_getslice('longbing_company_user', $where, $limit, $count, array(), '', array('create_time desc'));
//$sql = 'SELECT a.id,a.permission,b.company_id,b.name,b.phone,c.name FROM ' . tablename('longbing_company_user') . ' a LEFT JOIN ' . tablename('ims_longbing_company_user_info') . (' b ON a.id = b.fans_id and a.is_staff=1').'LEFT JOIN'.tablename('longbing_company_company').('c on b.company_id = c.id where a.is_staff=1');
if (!empty($users_search)) {
foreach ($users_search as $index => $item) {
$sign = true;
foreach ($users as $index2 => $item2) {
if ($item['id'] == $item2['id']) {
$sign = false;
break;
}
}
if ($sign) {
array_push($users, $item);
}
}
}
foreach ($users as $k => $v) {
$info2 = pdo_get('longbing_company_user_info', array('fans_id' => $v['id']));
$phone = pdo_get('longbing_company_user_phone', array('user_id' => $v['id']));
$company_name = pdo_get('longbing_company_company',array('id'=>$info2['company_id']));
$users[$k]['phone'] = $phone['phone'];
$users[$k]['company_name']=$company_name['name'];
if ($v['is_staff'] == 1) {
$info = pdo_get('longbing_company_user_info', array('fans_id' => $v['id']));
$users[$k]['is_default'] = $info ? $info['is_default'] : 0;
$users[$k]['name'] = $info ? $info['name'] : '';
$checkFile = false;
if ($v['qr_path']) {
if (file_exists(ATTACHMENT_ROOT . '/' . $v['qr_path'])) {
@$size = filesize(ATTACHMENT_ROOT . '/' . $v['qr_path']);
if ($size < 51220) {
$checkFile = true;
}
}
else {
$checkFile = true;
}
}
if ($v['qr_path'] == '' || $checkFile) {
$users[$k]['qr_path'] = '';
}
}
else {
$users[$k]['qr_path'] = '';
}
}
$perPage = 15;
load()->func('tpl');
include $this->template('manage/permission');
?>
\ No newline at end of file
......@@ -99,6 +99,8 @@ function createQr3($image, $path, $uniacid)
return false;
}
function getAccessToken2()
{
global $_GPC;
......@@ -280,7 +282,6 @@ if ($_GPC['action'] == 'addBoss') {
if ($user['is_staff'] != 1) {
message('该用户还不是员工', '', 'error');
}
$result = pdo_update('longbing_company_user', array('status' => 1, 'is_staff' => 1, 'update_time' => time(), 'is_boss' => 1), array('id' => $_GPC['id']));
if ($result) {
......@@ -295,6 +296,9 @@ if ($_GPC['action'] == 'addBoss') {
message('设置失败', '', 'error');
}
if ($_GPC['action'] == 'delBoss') {
$user = pdo_get('longbing_company_user', array('id' => $_GPC['id']));
......
......@@ -26,6 +26,9 @@ if($channel==3){
'is_level'=>0,
'channel'=>'线下'
);
// pdo_insert('longbing_card_usermember',$b);
}elseif($channel==2){
$b= array(
......@@ -41,6 +44,7 @@ if($channel==3){
);
}
pdo_insert('longbing_card_usermember',$b);
return $this->result(0, '请求成功', array());
......@@ -50,4 +54,9 @@ return $this->result(0, '请求成功', array());
?>
<?php
//dezend by http://www.yunlu99.com/
define('ROOT_PATH', IA_ROOT . '/addons/longbing_company/');
is_file(ROOT_PATH . '/inc/we7.php') || exit('Access Denied Longbing');
require_once ROOT_PATH . '/inc/we7.php';
global $_GPC;
global $_W;
$uniacid = $_W['uniacid'];
$uid = $_GPC['user_id'];
$type = $_GPC['type'];
$time = $_GPC['search_time'];
if (!$type) {
$type = 0;
}
$limit = array(1, 5);
$curr = 1;
if (isset($_GPC['page'])) {
$limit[0] = $_GPC['page'];
$curr = $_GPC['page'];
}
$where = array('uniacid' => $uniacid, 'status !=' => -1, 'user_id' => $uid);
$collage_overtime = 172800;
$info = pdo_get('longbing_company_config', array('uniacid' => $_W['uniacid']), array('collage_overtime'));
$collage_overtime = $info['collage_overtime'];
$tu = pdo_get('longbing_company_user_info',array('fans_id'=>$uid));
if (!$collage_overtime) {
$collage_overtime = 172800;
}
switch ($type) {
case 1:
$where['pay_status'] = 1;
$where['order_status'] = 0;
$where['company_id']=$tu['company_id'];
break;
case 2:
$where['pay_status'] = 1;
$where['order_status'] = 3;
$where['company_id']=$tu['company_id'];
break;
case 3:
$where['pay_status'] = 1;
$where['company_id']=$tu['company_id'];
break;
}
$list = pdo_getslice('longbing_company_shop_order', $where, $limit, $count, array(), '', array('id desc'));
//print_r($list);die;
foreach ($list as $k => $v) {
$sql = 'SELECT a.id,a.order_id,a.goods_id,a.name,a.cover,a.number,a.total_price,a.price,a.content,a.qr_code,b.id,b.unit FROM ' . tablename('longbing_company_shop_order_item') . ' a LEFT JOIN ' . tablename('longbing_company_goods') . (' b ON a.goods_id = b.id WHERE a.order_id = ' . $v['id'] . ' && a.uniacid = ' . $uniacid);
$goods_info = pdo_fetchall($sql);
foreach ($goods_info as $k2 => $v2) {
$goods_info[$k2]['cover_true'] = tomedia($v2['cover']);
}
$list[$k]['goods_info'] = $goods_info;
}
$data = array('page' => $curr, 'total_page' => ceil($count / 5), 'list' => $list);
return $this->result(0, '', $data);
?>
\ No newline at end of file
<?php
define('ROOT_PATH', IA_ROOT . '/addons/longbing_company/');
is_file(ROOT_PATH . '/inc/we7.php') || exit('Access Denied Longbing');
require_once ROOT_PATH . '/inc/we7.php';
global $_GPC;
global $_W;
$uniacid = $_W['uniacid'];
$module_name = $_W['current_module']['name'];
$order_id = $_GPC['order_id'];
$uid=$_GPC['user_id'];
$er = pdo_get('longbing_company_user',array('id'=>$uid));
if($er['permission']==1) {
if ($order_id) {
$a = pdo_update('longbing_company_shop_order', array('order_status' => 3), array('id' => $order_id, 'pay_status' => 1));
if (!empty($a)) {
return $this->result(0, '审核成功', array());
}
return $this->result(-1, '审核失败', array());
}
return $this->result(-1, '订单号为空', array());
}
return $this->result(-1, '没有扫码权限', array());
?>
\ No newline at end of file
<?php
//dezend by http://www.yunlu99.com/
define('ROOT_PATH', IA_ROOT . '/addons/longbing_company/');
is_file(ROOT_PATH . '/inc/we7.php') || exit('Access Denied Longbing');
define('LOGGING_TRACE', 'trace');
require_once ROOT_PATH . '/inc/we7.php';
global $_GPC;
global $_W;
$uniacid = $_W['uniacid'];
$uid = $_GPC['user_id'];
$id = $_GPC['id'];
//if (!$uid || !$id) {
// return $this->result(-1, '', array());
//}
$r=pdo_get('longbing_company_user',array('id'=>$uid));
if($r['permission']==1) {
$where = array('uniacid' => $uniacid, 'id' => $id);
$info = pdo_get('longbing_company_shop_order', $where);
if (!$info) {
return $this->result(-1, '', array());
}
$sql = 'SELECT a.id,a.order_id,a.goods_id,a.name,a.cover,a.number,a.price,a.trip_time,a.company_id,a.company_name,a.spe_price_id,b.id,b.unit FROM ' . tablename('longbing_company_shop_order_item') . ' a LEFT JOIN ' . tablename('longbing_company_goods') . (' b ON a.goods_id = b.id WHERE a.order_id = ' . $id . ' && a.uniacid = ' . $uniacid);
$goods_info = pdo_fetchall($sql);
foreach ($goods_info as $k => $v) {
$goods_info[$k]['cover_true'] = tomedia($v['cover']);
$spe_price = pdo_get('longbing_company_shop_spe_price', array('id' => $v['spe_price_id'], 'uniacid' => $uniacid));
$spe_id_1 = $spe_price['spe_id_1'];
$arr = explode('-', $spe_id_1);
$str = implode(',', $arr);
if (strpos($str, ',')) {
$str = '(' . $str . ')';
$sql = 'SELECT * FROM ' . tablename('longbing_company_shop_spe') . (' WHERE id IN ' . $str);
} else {
$sql = 'SELECT * FROM ' . tablename('longbing_company_shop_spe') . (' WHERE id = ' . $str);
}
$speList = pdo_fetchall($sql);
$titles = '';
foreach ($speList as $k2 => $v2) {
$titles .= '-' . $v2['title'];
}
$titles = trim($titles, '-');
$goods_info[$k]['titles'] = $titles;
}
if ($info['type'] == 1) {
$collage = pdo_get('longbing_company_shop_collage_list', array('id' => $info['collage_id']));
$info['collage_info'] = $collage;
$users = pdo_getall('longbing_company_shop_user_collage', array('collage_id' => $info['collage_id']), array('user_id'), '', array('id asc'));
$ids = '';
foreach ($users as $k2 => $v2) {
$ids .= ',' . $v2['user_id'];
}
$ids = trim($ids, ',');
if (1 < count($users)) {
$ids = '(' . $ids . ')';
$sql = 'SELECT id, nickName, `avatarUrl` FROM ' . tablename('longbing_company_user') . (' WHERE uniacid = ' . $uniacid . ' && id in ' . $ids);
} else {
$sql = 'SELECT id, nickName, `avatarUrl` FROM ' . tablename('longbing_company_user') . (' WHERE uniacid = ' . $uniacid . ' && id = ' . $ids);
}
$users = pdo_fetchall($sql);
$info['users'] = array();
foreach ($users as $k2 => $v2) {
if ($v2['id'] == $collage['user_id']) {
$info['own'] = $v2;
} else {
$info['users'][] = $v2;
}
}
}
$info['goods_info'] = $goods_info;
if ($info['pay_status'] == 0) {
$left_time = 172800 - (time() - $info['create_time']);
$info['left_time'] = $left_time;
}
//$user_info = pdo_get('longbing_company_user_info', array('fans_id' => $info['to_uid']));
$user_info['avatar_true'] = tomedia($user_info['avatar']);
$info['user_info'] = $user_info;
return $this->result(0, '', $info);
}
return $this->result(-1, '没有扫码权限', array());
?>
\ No newline at end of file
......@@ -141,9 +141,9 @@ $to_uid = $_GPC['to_uid'];
$goods_id = $_GPC['goods_id'];
//$d = $_GPC['m_price'];
$is_member = $_GPC['is_member'];
if (!$to_uid) {
return $this->result(-1, '不存在to_uid', array());
}
//if (!$to_uid) {
// return $this->result(-1, '不存在to_uid', array());
//}
$u = pdo_get('longbing_company_user',array("id"=>$uid));
......@@ -195,6 +195,7 @@ if($level>0){
}
}
$goods['start_time']=json_decode($goods['start_time']);
$goods['companyList']=getCompanys($goods['id']);
$goods['spe_list'] = $speList;
$spe_price = pdo_getall('longbing_company_shop_spe_price', array('goods_id' => $goods_id, 'status' => 1, 'uniacid' => $uniacid), array('id', 'spe_id_1', 'price', 'stock'));
......@@ -339,7 +340,7 @@ if($level>0){
return $this->result(-1, '', array('id' => $goods_id));
}
$goods['start_time']=json_decode($goods['start_time']);
$goods['cover_true'] = tomedia($goods['cover']);
$goods['images_true'] = array();
$images = $goods['images'];
......@@ -585,7 +586,7 @@ if($level>0){
$titles = trim($titles, '-');
$collage[$k]['titles'] = $titles;
}
$goods['start_time']=json_decode($goods['start_time']);
$goods['collage'] = $collage;
$destination_folder = '/images' . ('/longbing_company/' . $_W['uniacid']);
$image = $destination_folder . '/' . $_W['uniacid'] . '-goods-' . $goods_id . '-' . $to_uid . 'qr.png';
......
......@@ -58,7 +58,7 @@ case 4:
$list = pdo_getslice('longbing_company_shop_order', $where, $limit, $count, array(), '', array('id desc'));
foreach ($list as $k => $v) {
$sql = 'SELECT a.id,a.order_id,a.goods_id,a.name,a.cover,a.number,a.total_price,a.content,b.id,b.unit FROM ' . tablename('longbing_company_shop_order_item') . ' a LEFT JOIN ' . tablename('longbing_company_goods') . (' b ON a.goods_id = b.id WHERE a.order_id = ' . $v['id'] . ' && a.uniacid = ' . $uniacid);
$sql = 'SELECT a.id,a.order_id,a.goods_id,a.name,a.cover,a.number,a.total_price,a.price,a.content,a.qr_code,b.id,b.unit,b.is_free_card FROM ' . tablename('longbing_company_shop_order_item') . ' a LEFT JOIN ' . tablename('longbing_company_goods') . (' b ON a.goods_id = b.id WHERE a.order_id = ' . $v['id'] . ' && a.uniacid = ' . $uniacid);
$goods_info = pdo_fetchall($sql);
foreach ($goods_info as $k2 => $v2) {
......
......@@ -59,8 +59,12 @@ if ($info['pay_status'] == 0 && $info['order_status'] != 1) {
$sql = 'SELECT a.id,a.order_id,a.goods_id,a.name,a.cover,a.number,a.price,a.trip_time,a.company_id,a.company_name,a.spe_price_id,b.id,b.unit FROM ' . tablename('longbing_company_shop_order_item') . ' a LEFT JOIN ' . tablename('longbing_company_goods') . (' b ON a.goods_id = b.id WHERE a.order_id = ' . $id . ' && a.uniacid = ' . $uniacid);
$sql = 'SELECT a.id,a.order_id,a.goods_id,a.name,a.cover,a.number,a.price,a.trip_time,a.company_id,a.company_name,a.spe_price_id,a.qr_code,b.id FROM ' . tablename('longbing_company_shop_order_item') . ' a LEFT JOIN ' . tablename('longbing_company_goods') . (' b ON a.goods_id = b.id WHERE a.order_id = ' . $id . ' && a.uniacid = ' . $uniacid);
$goods_info = pdo_fetchall($sql);
$fg = pdo_get('longbing_company_shop_order_item',array('order_id'=>$id));
$is_vip=pdo_get('longbing_company_goods',array('id'=>$fg['goods_id']));
foreach ($goods_info as $k => $v) {
$goods_info[$k]['cover_true'] = tomedia($v['cover']);
......@@ -86,6 +90,9 @@ foreach ($goods_info as $k => $v) {
$titles = trim($titles, '-');
$goods_info[$k]['titles'] = $titles;
$goods_info[$k]['is_free_card'] = $is_vip['is_free_card'];
}
if ($info['type'] == 1) {
......@@ -133,4 +140,5 @@ $user_info['avatar_true'] = tomedia($user_info['avatar']);
$info['user_info'] = $user_info;
return $this->result(0, '', $info);
?>
......@@ -12,13 +12,15 @@ $to_uid = $_GPC['to_uid'];
$record_id = $_GPC['record_id'];
$number = $_GPC['number'];
$goods_id = $_GPC['goods_id'];
$trip_time = $_GPC['trip_time']?strtotime($_GPC['trip_time']):0;
$trip_time = $_GPC['trip_time'];
$company_id = $_GPC['company_id'];
$company_name = $_GPC['company_name'];
$spe_id = $_GPC['spe_price_id'];
//$disprice=$_GPC['m_price'];
$is_discount = $_GPC['is_discount'];
$leve_id=$_GPC['leve_id'];
$person =$_GPC['name'];
$phone=$_GPC['phone'];
/*if (!$address_id || !$number || !$goods_id) {
return $this->result(-1, '', array());
}*/
......@@ -40,14 +42,79 @@ if($g_level['is_free_card']==1){
}
function getAccessToken2()
{
global $_GPC;
global $_W;
$appid = $_W['account' ]['key'];
$appsecret = $_W['account']['secret'];
$appidMd5 = md5($appid);
if (!is_file(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt')) {
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret;
$data = ihttp_get($url);
$data = json_decode($data['content'], true);
if (!isset($data['access_token'])) {
return false;
}
$access_token = $data['access_token'];
file_put_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt', json_encode(array('at' => $access_token, 'time' => time() + 6200)));
return $access_token;
}
if (is_file(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt')) {
$fileInfo = file_get_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt');
if (!$fileInfo) {
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret;
$data = ihttp_get($url);
$data = json_decode($data['content'], true);
if (!isset($data['access_token'])) {
return false;
}
$access_token = $data['access_token'];
file_put_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt', json_encode(array('at' => $access_token, 'time' => time() + 6200)));
return $access_token;
}
$fileInfo = json_decode($fileInfo, true);
if ($fileInfo['time'] < time()) {
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret;
$data = ihttp_get($url);
$data = json_decode($data['content'], true);
if (!isset($data['access_token'])) {
return false;
}
$access_token = $data['access_token'];
file_put_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt', json_encode(array('at' => $access_token, 'time' => time() + 6200)));
return $access_token;
}
return $fileInfo['at'];
}
return false;
}
$trip_time=json_decode($trip_time);
//$order_items1 = pdo_get('longbing_company_shop_order_item',array('user_id'=>$uid));
$u = pdo_get('longbing_company_user',array('id'=>$uid));
$leveid=$u['level_id'];
if($leveid>0) {
if($is_discount==0){
if (!$number || !$goods_id) {
return $this->result(-1, '', array());
}
return $this->result(-1, '', array());
}
$goods_info = pdo_get('longbing_company_goods', array('id' => $goods_id));
$spe_info = pdo_get('longbing_company_shop_spe_price', array('id' => $spe_id));
......@@ -87,7 +154,7 @@ $leveid=$u['level_id'];
$time = time();
$total_freight = sprintf('%.2f', $goods_info['freight']);
$price = sprintf('%.2f', $spe_info['price'] * $number);
$insertOrder = array('user_id' => $uid,'to_uid'=>$to_uid, 'level_id'=>$goods_info['leve_id'], 'freight' => $total_freight, 'price' => $price, 'total_disprice'=>0,'discount_price'=>$total_freight + $price, 'total_price' => $total_freight + $price, 'uniacid' => $uniacid, 'name' => $address['name'], 'sex' => $address['sex'], 'phone' => $address['phone'], 'address' => $address['address'], 'address_detail' => $address['address_detail'], 'province' => $address['province'], 'city' => $address['city'], 'area' => $address['area'], 'to_uid' => $to_uid, 'create_time' => $time, 'update_time' => $time);
$insertOrder = array('user_id' => $uid, 'company_id' => $company_id,'to_uid'=>$to_uid,'trip_time'=>$trip_time,'phone'=>$phone,'name'=>$person, 'level_id'=>$goods_info['leve_id'], 'freight' => $total_freight, 'price' => $price, 'total_disprice'=>0,'discount_price'=>$total_freight + $price, 'total_price' => $total_freight + $price, 'uniacid' => $uniacid, 'name' => $address['name'], 'sex' => $address['sex'], 'phone' => $address['phone'], 'address' => $address['address'], 'address_detail' => $address['address_detail'], 'province' => $address['province'], 'city' => $address['city'], 'area' => $address['area'], 'to_uid' => $to_uid, 'create_time' => $time, 'update_time' => $time);
if ($record_id) {
$sign = true;
......@@ -128,11 +195,13 @@ $leveid=$u['level_id'];
if (!empty($result)) {
$order_id = pdo_insertid();
$insertItem = array('order_id' => $order_id,'user_id'=>$uid,'level_id'=>$goods_info['leve_id'], 'goods_id' => $goods_id, 'name' => $goods_info['name'], 'cover' => $goods_info['cover'], 'spe_price_id' => $spe_id, 'content' => $titles, 'number' => $number, 'price' => sprintf('%.2f', $spe_info['price'] * $number), 'uniacid' => $uniacid, 'create_time' => $time, 'update_time' => $time, 'company_id' => $company_id, 'trip_time' => $trip_time, 'company_name' => $company_name,'user_id'=>$uid,'level_id'=>$leve_id,'total_price'=>$total_freight + $price,'total_disprice'=>0,'discount_price'=>$total_freight + $price);
$insertItem = array('order_id' => $order_id,'user_id'=>$uid,'phone'=>$phone,'person'=>$person, 'level_id'=>$goods_info['leve_id'], 'goods_id' => $goods_id, 'name' => $goods_info['name'], 'cover' => $goods_info['cover'], 'spe_price_id' => $spe_id, 'content' => $titles, 'number' => $number, 'price' => sprintf('%.2f', $spe_info['price'] * $number), 'uniacid' => $uniacid, 'create_time' => $time, 'update_time' => $time, 'company_id' => $company_id, 'trip_time' => $trip_time, 'company_name' => $company_name,'user_id'=>$uid,'level_id'=>$leve_id,'total_price'=>$total_freight + $price,'total_disprice'=>0,'discount_price'=>$total_freight + $price);
$result = pdo_insert('longbing_company_shop_order_item', $insertItem);
return $this->result(0, '', array('order_id' => $order_id));
}
}
return $this->result(-1, '', array());
}
//当为折扣商品时
......@@ -189,7 +258,7 @@ $leveid=$u['level_id'];
$total_disprice=sprintf('%.2f',$total_disprice);
$total_price= $total_freight + $price*$discount/100;//总计:运费+折扣价
$total_price=sprintf('%.2f',$total_price);
$insertOrder = array('user_id' => $uid,'to_uid'=>$to_uid ,'level_id'=>$goods_info['leve_id'], 'freight' => $total_freight, 'price' => $price, 'total_disprice'=>$total_disprice,'discount_price' => $discount_price, 'total_price' =>$total_price, 'uniacid' => $uniacid, 'name' => $address['name'], 'sex' => $address['sex'], 'phone' => $address['phone'], 'address' => $address['address'], 'address_detail' => $address['address_detail'], 'province' => $address['province'], 'city' => $address['city'], 'area' => $address['area'], 'to_uid' => $to_uid, 'create_time' => $time, 'update_time' => $time);
$insertOrder = array('user_id' => $uid,'company_id' => $company_id ,'to_uid'=>$to_uid ,'phone'=>$phone,'name'=>$person,'level_id'=>$goods_info['leve_id'], 'freight' => $total_freight, 'price' => $price, 'total_disprice'=>$total_disprice,'discount_price' => $discount_price, 'total_price' =>$total_price, 'uniacid' => $uniacid, 'name' => $address['name'], 'sex' => $address['sex'], 'phone' => $address['phone'], 'address' => $address['address'], 'address_detail' => $address['address_detail'], 'province' => $address['province'], 'city' => $address['city'], 'area' => $address['area'], 'to_uid' => $to_uid, 'create_time' => $time, 'update_time' => $time);
if ($record_id) {
$sign = true;
......@@ -230,7 +299,7 @@ $leveid=$u['level_id'];
if (!empty($result)) {
$order_id = pdo_insertid();
$insertItem = array('order_id' => $order_id, 'user_id'=>$uid,'level_id'=>$goods_info['leve_id'], 'goods_id' => $goods_id, 'name' => $goods_info['name'], 'cover' => $goods_info['cover'], 'spe_price_id' => $spe_id, 'content' => $titles, 'number' => $number, 'price' => sprintf('%.2f', $spe_info['price'] * $number), 'uniacid' => $uniacid, 'create_time' => $time, 'update_time' => $time, 'company_id' => $company_id, 'trip_time' => $trip_time, 'company_name' => $company_name,'total_price'=>$total_price,'total_disprice'=>$total_disprice,'discount_price'=>$discount_price,'user_id'=>$uid,'level_id'=>$leve_id );
$insertItem = array('order_id' => $order_id,'person'=>$person,'phone'=>$phone, 'user_id'=>$uid,'level_id'=>$goods_info['leve_id'], 'goods_id' => $goods_id, 'name' => $goods_info['name'], 'cover' => $goods_info['cover'], 'spe_price_id' => $spe_id, 'content' => $titles, 'number' => $number, 'price' => sprintf('%.2f', $spe_info['price'] * $number), 'uniacid' => $uniacid, 'create_time' => $time, 'update_time' => $time, 'company_id' => $company_id, 'trip_time' => $trip_time, 'company_name' => $company_name,'total_price'=>$total_price,'total_disprice'=>$total_disprice,'discount_price'=>$discount_price,'user_id'=>$uid,'level_id'=>$leve_id );
$result = pdo_insert('longbing_company_shop_order_item', $insertItem);
return $this->result(0, '', array('order_id' => $order_id));
}
......@@ -284,7 +353,7 @@ $leveid=$u['level_id'];
$time = time();
$total_freight = sprintf('%.2f', $goods_info['freight']);
$price = sprintf('%.2f', $spe_info['price'] * $number);
$insertOrder = array('user_id' => $uid,'to_uid'=>$to_uid , 'level_id'=>$goods_info['leve_id'],'freight' => $total_freight, 'price' => $price, 'total_disprice'=>0,'discount_price' =>$total_freight + $price , 'total_price' => $total_freight + $price, 'uniacid' => $uniacid, 'name' => $address['name'], 'sex' => $address['sex'], 'phone' => $address['phone'], 'address' => $address['address'], 'address_detail' => $address['address_detail'], 'province' => $address['province'], 'city' => $address['city'], 'area' => $address['area'], 'to_uid' => $to_uid, 'create_time' => $time, 'update_time' => $time);
$insertOrder = array('user_id' => $uid, 'company_id' => $company_id ,'to_uid'=>$to_uid ,'phone'=>$phone,'name'=>$person, 'level_id'=>$goods_info['leve_id'],'freight' => $total_freight, 'price' => $price, 'total_disprice'=>0,'discount_price' =>$total_freight + $price , 'total_price' => $total_freight + $price, 'uniacid' => $uniacid, 'name' => $address['name'], 'sex' => $address['sex'], 'phone' => $address['phone'], 'address' => $address['address'], 'address_detail' => $address['address_detail'], 'province' => $address['province'], 'city' => $address['city'], 'area' => $address['area'], 'to_uid' => $to_uid, 'create_time' => $time, 'update_time' => $time);
if ($record_id) {
$sign = true;
......@@ -325,7 +394,7 @@ $leveid=$u['level_id'];
if (!empty($result)){
$order_id = pdo_insertid();
$insertItem = array('order_id' => $order_id,'user_id'=>$uid,'level_id'=>$goods_info['leve_id'], 'goods_id' => $goods_id, 'name' => $goods_info['name'], 'cover' => $goods_info['cover'], 'spe_price_id' => $spe_id, 'content' => $titles, 'number' => $number, 'price' => sprintf('%.2f', $spe_info['price'] * $number), 'uniacid' => $uniacid, 'create_time' => $time, 'update_time' => $time, 'company_id' => $company_id, 'trip_time' => $trip_time, 'company_name' => $company_name,'total_disprice'=>0,'discount_price' =>$total_freight + $price , 'total_price' => $total_freight + $price,);
$insertItem = array('order_id' => $order_id,'user_id'=>$uid,'phone'=>$phone,'person'=>$person, 'level_id'=>$goods_info['leve_id'], 'goods_id' => $goods_id, 'name' => $goods_info['name'], 'cover' => $goods_info['cover'], 'spe_price_id' => $spe_id, 'content' => $titles, 'number' => $number, 'price' => sprintf('%.2f', $spe_info['price'] * $number), 'uniacid' => $uniacid, 'create_time' => $time, 'update_time' => $time, 'company_id' => $company_id, 'trip_time' => $trip_time, 'company_name' => $company_name,'total_disprice'=>0,'discount_price' =>$total_freight + $price , 'total_price' => $total_freight + $price,);
$result = pdo_insert('longbing_company_shop_order_item', $insertItem);
return $this->result(0, '', array('order_id' => $order_id));
}
......
<?php
define('ROOT_PATH', IA_ROOT . '/addons/longbing_company/');
is_file(ROOT_PATH . '/inc/we7.php') || exit('Access Denied Longbing');
require_once ROOT_PATH . '/inc/we7.php';
global $_GPC;
global $_W;
$uniacid = $_W['uniacid'];
$module_name = $_W['current_module']['name'];
$order_id = $_GPC['order_id'];
$uid=$_GPC['user_id'];
function getAccessToken2()
{
global $_GPC;
global $_W;
$appid = $_W['account' ]['key'];
$appsecret = $_W['account']['secret'];
$appidMd5 = md5($appid);
if (!is_file(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt')) {
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret;
$data = ihttp_get($url);
$data = json_decode($data['content'], true);
if (!isset($data['access_token'])) {
return false;
}
$access_token = $data['access_token'];
file_put_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt', json_encode(array('at' => $access_token, 'time' => time() + 6200)));
return $access_token;
}
if (is_file(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt')) {
$fileInfo = file_get_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt');
if (!$fileInfo) {
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret;
$data = ihttp_get($url);
$data = json_decode($data['content'], true);
if (!isset($data['access_token'])) {
return false;
}
$access_token = $data['access_token'];
file_put_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt', json_encode(array('at' => $access_token, 'time' => time() + 6200)));
return $access_token;
}
$fileInfo = json_decode($fileInfo, true);
if ($fileInfo['time'] < time()) {
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret;
$data = ihttp_get($url);
$data = json_decode($data['content'], true);
if (!isset($data['access_token'])) {
return false;
}
$access_token = $data['access_token'];
file_put_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt', json_encode(array('at' => $access_token, 'time' => time() + 6200)));
return $access_token;
}
return $fileInfo['at'];
}
return false;
}
global $_W;
$u = pdo_get('longbing_company_user',array('id'=>$uid));
load()->func('file');
if (!is_dir(ATTACHMENT_ROOT . '/' . 'images')) {
mkdir(ATTACHMENT_ROOT . '/' . 'images');
}
if (!is_dir(ATTACHMENT_ROOT . '/' . 'images/longbing_company')) {
mkdir(ATTACHMENT_ROOT . '/' . 'images/longbing_company');
}
if (!is_dir(ATTACHMENT_ROOT . '/' . ('images/longbing_company/' . $_W['uniacid'] . '/'))) {
mkdir(ATTACHMENT_ROOT . '/' . ('images/longbing_company/' . $_W['uniacid'] . '/'));
}
$destination_folder = ATTACHMENT_ROOT . '/images' . ('/longbing_company/' . $_W['uniacid']);
$image = $destination_folder . '/' . $_W['uniacid'] . '-' .$order_id .'qr.png';
$path = '/longbing_company/users/pages/uCenter/order/orderDetail/orderDetail?orderId='.$order_id;
$res = $this->createQr($image, $path);
$image = tomedia('images' . ('/longbing_company/' . $_W['uniacid'] . '/') . $_W['uniacid'] . '-' .$order_id. 'qr.png');
if (!strstr($image, 'ttp')) {
$image = 'https://' . $image;
}
//pdo_update('longbing_company_user', array('qr_path' => 'images' . ('/longbing_company/' . $_W['uniacid'] . '/') . $_W['uniacid'] . '-' . $to_uid . 'qr.png'), array('id' => $to_uid));
$image = $this->transImage($image);
if(!empty($image)) {
return $this->result(0, '成功生成二维码', $image, array());
//print_r($image);die;
}
return $this->result(-1, '生成二维码失败', array());
?>
\ No newline at end of file
......@@ -81,6 +81,8 @@ class longbing_companyModule extends WeModule
$couponList = $this->createWebUrl('manage/coupon');
$groupSending = $this->createWebUrl('manage/groupsending');
$handover = $this->createWebUrl('manage/handover');
$permission = $this->createWebUrl('manage/permission');
$profitList = $this->createWebUrl('manage/profit');
$waterList = $this->createWebUrl('manage/water');
$cashList = $this->createWebUrl('manage/cash');
......
......@@ -328,15 +328,13 @@
</div>
</div>-->
<div class="layui-inline" style="float: left">
<label class="layui-form-label">时间范围</label>
<div class="layui-input-inline">
<label class="layui-form-label">出发时间</label>
<div class="layui-input-inline add">
<input type="text" value="" class="layui-input" name="start_time" id="StartTime" placeholder="年-月-日" >
</div>
<div class="layui-input-inline">
<input type="text" value="" class="layui-input" name="end_time" id="EndTime" placeholder="年-月-日">
</div>
<div style="clear: both;padding-top: 15px;"><button class="layui-btn" onclick="dayHtml();return false;">+添加</button></div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">设为推荐</label>
......@@ -410,7 +408,19 @@
<span class="span-remark">设为推荐则该商品折扣价</span>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">设为预约租车</label>
<div class="layui-input-block">
{if $info['is_make'] == 1}
<input type="radio" name="is_make" value="1" title="是" checked>
<input type="radio" name="is_make" value="0" title="否">
{else}
<input type="radio" name="is_make" value="1" title="是">
<input type="radio" name="is_make" value="0" title="否" checked>
{/if}
<span class="span-remark">设为预约租车</span>
</div>
</div>
......@@ -449,6 +459,35 @@
<script src="../../../addons/{$module_name}/images/layuiadmin/layui/layui.js"></script>
<script>
function dayHtml(){
var html = "";
html+='<div class="layui-input-inline" style="width: 100px;">';
html+='<input type="text" name="start_time" Id="StartTime" class="layui-input" placeholder="年-月-日" />';
html+='</div>';
$(".add").append(html);
}
function getDatas(){
var l = $(".dayHtml input[name='start_time']").size();
if(l==0){
return "";
}else{
var jsonList = [];
for(var i=0;i<l;i++){
$day=$(".dayHtml input[name='start_time']").eq(i).val();
// $point=$(".dayHtml input[name='dayVal']").eq(i).val();
if($day){
jsonList[i]={
"day":$day,
}
}
}
return jsonList;
}
}
function nums(e){
if(e>9){
return e;
......@@ -518,12 +557,8 @@
var start_timeD = new Date(formData.start_time);
formData.start_time=start_timeD.getTime()/1000;
}
if(formData.end_time){
var end_timeD = new Date(formData.end_time);
formData.end_time=end_timeD.getTime()/1000;
}
var url = "{php echo $this->createWebUrl('manage/goodsedit')}";
var url = "{php echo $this->createWebUrl('manage/goodsedit')}";
var id = '{$id}';
var data = {
action: 'edit',
......@@ -533,6 +568,7 @@
if (id > 0) {
data.id = id;
}
postData(url, data);
return false;
......
......@@ -165,6 +165,19 @@
</a>
</li>
<li data-name="handover" class="layui-nav-item">
<a href="javascript:;" lay-href="{$permission}" lay-tips="</a>" lay-direction="2">
<!--<i class="layui-icon layui-icon-set" style="color: #898989"></i>-->
<img src="https://retail.xiaochengxucms.com/images/2/2018/12/NdEO9U4zo3c307oZJs9656osj2j6e4.png" class="icon-img">
<cite style="color: #898989">员工权限</cite>
</a>
</li>
<li data-name="goods" class="layui-nav-item">
<a href="javascript:;" lay-tips="商品管理" lay-direction="2">
<!--<i class="layui-icon layui-icon-component" style="color: #898989"></i>-->
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="../../../addons/{$module_name}/images/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../../addons/{$module_name}/images/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" href="../../../addons/{$module_name}/images/css/main.css" media="all">
</head>
<body>
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">员工权限</div>
<div class="layui-card-body">
<div class="div-search-body">
<form class="form-inline">
<div class="form-group" style="display: inline-block;width: 50%">
<label class="sr-only"></label>
<div class="input-group">
<input type="text" name="title" required lay-verify="required" placeholder="请输入搜索内容" autocomplete="off" class="layui-input" id="inputSearch" value="{$keyword}">
</div>
</div>
<button class="layui-btn layui-btn-normal btn-search" type="button">
搜索
</button>
</form>
</div>
<table class="layui-table">
<thead>
<tr>
<th>用户ID</th>
<th>姓名</th>
<th>所属公司</th>
<th>授权手机号</th>
<th>加入时间</th>
<th>用户类型</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{loop $users $item}
<tr>
<td>{$item['id']}</td>
<td>{$item['name']}</td>
<td>{$item['company_name']}</td>
<td>{$item['phone']}</td>
<td>{php echo date('Y-m-d H:i:s', $item['create_time'])}</td>
<td>
{if $item['permission'] == 1}
<span class="layui-badge layui-bg-blue">扫码权限</span>
{/if}
</td>
<td>
{if $item['permission']==0}
<button type="button" class="layui-btn layui-btn-xs btn-add-boss"
itemId="{$item['id']}">
设置扫码权限
</button>
{else}
<button type="button" class="layui-btn layui-btn-xs btn-del-boss"
itemId="{$item['id']}">
取消扫码权限
</button>
{/if}
</td>
</tr>
{/loop}
</tbody>
</table>
<div id="dataTable"></div>
</div>
</div>
</div>
</div>
</div>
<img class="qr_img" src= "" download="" />
<script src="../../../addons/{$module_name}/images/layuiadmin/layui/layui.js"></script>
<script src="../../../addons/{$module_name}/images/js/jquery.min.js"></script>
<script>
var keyword = $('#inputSearch').val();
var curr_page = {$curr};
layui.use(['layer', 'laypage'], function () {
var layer = layui.layer
, laypage = layui.laypage;
//执行一个laypage实例
laypage.render({
elem: 'dataTable' //注意,这里的 test1 是 ID,不用加 # 号
, count: {$count} //数据总数,从服务端得到
, curr: {$curr}
, limit: {$perPage} //每页显示的条数
,layout: ['count', 'prev', 'page', 'next', 'refresh', 'skip']
, jump: function (obj, first) {
//obj包含了当前分页的所有参数,比如:
//首次不执行
if (!first) {
//do something
layer.load();
window.location.href = "{php echo $this->createWebUrl('manage/permission')}" + "&page=" + obj.curr + "&keyword=" + keyword;
}
}
});
});
// 搜索内容
$('.btn-search').click(function () {
var keyword = $('#inputSearch').val();
if (!keyword) {
window.location.href = "{php echo $this->createWebUrl('manage/permission')}";
return false;
}
layer.load();
window.location.href = "{php echo $this->createWebUrl('manage/permission')}" + "&keyword=" + keyword;
return false;
});
// 添加员工
$('.btn-add-stock').click(function () {
var id = $(this).attr('itemId');
if (!id) {
layer.msg('获取用户id失败!');
return false;
}
layer.open({
content: '是否将该用户添加为股东并创建名片',
yes: function (index, layero) {
layer.close(index); //如果设定了yes回调,需进行手工关闭
layer.load();
var url = "{php echo $this->createWebUrl('manage/users')}";
var data = {
action: 'addStaff',
is_stock:1,
id: id
};
postData(url, data);
}
});
});
// 添加员工
$('.btn-add-staff').click(function () {
var id = $(this).attr('itemId');
if (!id) {
layer.msg('获取用户id失败!');
return false;
}
layer.open({
content: '是否将该用户添加为员工并创建名片',
yes: function (index, layero) {
layer.close(index); //如果设定了yes回调,需进行手工关闭
layer.load();
var url = "{php echo $this->createWebUrl('manage/users')}";
var data = {
action: 'addStaff',
id: id
};
postData(url, data);
}
});
});
// 添加权限
$('.btn-add-boss').click(function () {
var id = $(this).attr('itemId');
if (!id) {
layer.msg('获取用户id失败!');
return false;
}
layer.open({
content: '设置扫码权限?',
yes: function (index, layero) {
layer.close(index); //如果设定了yes回调,需进行手工关闭
layer.load();
var url = "{php echo $this->createWebUrl('manage/permission')}";
var data = {
action: 'addPermission',
id: id
};
postData(url, data);
}
});
});
// 移除权限
$('.btn-del-boss').click(function () {
var id = $(this).attr('itemId');
if (!id) {
layer.msg('获取用户id失败!');
return false;
}
layer.open({
content: '取消扫码权限',
yes: function (index, layero) {
layer.close(index); //如果设定了yes回调,需进行手工关闭
layer.load();
var url = "{php echo $this->createWebUrl('manage/permission')}";
var data = {
action: 'delPermission',
id: id
};
postData(url, data);
}
});
});
// 移除员工
$('.btn-del-staff').click(function () {
var id = $(this).attr('itemId');
if (!id) {
layer.msg('获取用户id失败!');
return false;
}
layer.open({
content: '移除员工',
yes: function (index, layero) {
layer.close(index); //如果设定了yes回调,需进行手工关闭
layer.load();
var url = "{php echo $this->createWebUrl('manage/users')}";
var data = {
action: 'delStaff',
id: id
};
postData(url, data);
}
});
});
// 管理名片
$('.btn-add-card').click(function () {
layer.load();
var id = $(this).attr('itemId');
if (!id) {
layer.msg('获取用户id失败!');
return false;
}
window.location.href = "{php echo $this->createWebUrl('manage/cardEdit')}" + "&fanid=" + id;
return false;
});
// 设为推荐员工
$('.btn-add-default').click(function () {
var id = $(this).attr('itemId');
if (!id) {
layer.msg('获取id失败!');
return false;
}
layer.open({
content: '设为推荐员工名片',
yes: function (index, layero) {
layer.close(index); //如果设定了yes回调,需进行手工关闭
layer.load();
var url = "{php echo $this->createWebUrl('manage/users')}";
var data = {
action: 'addDefault',
id: id
};
postData(url, data);
}
});
});
// 取消推荐员工
$('.btn-del-default').click(function () {
var id = $(this).attr('itemId');
if (!id) {
layer.msg('获取id失败!');
return false;
}
layer.open({
content: '取消推荐员工名片',
yes: function (index, layero) {
layer.close(index); //如果设定了yes回调,需进行手工关闭
layer.load();
var url = "{php echo $this->createWebUrl('manage/users')}";
var data = {
action: 'delDefault',
id: id
};
postData(url, data);
}
});
});
// 重新生成名片码
$('.btn-recreate-card').click(function () {
var id = $(this).attr('itemId');
if (!id) {
layer.msg('获取id失败!');
return false;
}
layer.open({
content: '是否重新生成二维码',
yes: function (index, layero) {
layer.close(index); //如果设定了yes回调,需进行手工关闭
layer.load();
var url = "{php echo $this->createWebUrl('manage/users')}";
var data = {
action: 'recreate',
id: id
};
postData(url, data);
}
});
});
function showBig (obj) {
var url = $(obj).attr('src');
layer.open({
type: 1,
title: false,
closeBtn: 0,
shadeClose: true,
skin: 'yourClass',
content: '<div style="padding: 20px; width: 300px; height: 300px;"><img style="width: 100%;height: 100%" src="' + url + '" /></div>'
});
}
function downlQr (obj) {
var qr = $(obj).attr('itemQr');
window.open(qr)
// var a = document.createElement('a');
// var event = new MouseEvent('click');
}
</script>
<script src="../../../addons/{$module_name}/images/js/main.js"></script>
</body>
</html>
\ No newline at end of file
......@@ -70,7 +70,6 @@
{else}
{if $item['is_staff'] == 1}
{if $item['is_stock'] == 1}
<td><span class="layui-badge layui-bg-blue">股东</span></td>
{else}
<td><span class="layui-badge layui-bg-blue">员工</span></td>
......
......@@ -9528,6 +9528,7 @@ class longbing_companyModuleWxapp extends WeModuleWxapp
public function payResult($log)
{
global $_GPC;
global $_W;
if ($log['result'] == 'success' && $log['tid']) {
$out_trade_no = $log['tid'];
......@@ -9570,7 +9571,6 @@ class longbing_companyModuleWxapp extends WeModuleWxapp
pdo_update('longbing_company_goods', array('collage_count +=' => $v['number']), array('id' => $v['goods_id']));
}
}
$mark = pdo_get('longbing_company_user_mark', array('user_id' => $order['user_id'], 'staff_id' => $order['to_uid']));
if (!$mark) {
......@@ -9616,6 +9616,40 @@ class longbing_companyModuleWxapp extends WeModuleWxapp
}
global $_W;
//$u = pdo_get('longbing_company_user',array('id'=>$uid));
load()->func('file');
if (!is_dir(ATTACHMENT_ROOT . '/' . 'images')) {
mkdir(ATTACHMENT_ROOT . '/' . 'images');
}
if (!is_dir(ATTACHMENT_ROOT . '/' . 'images/longbing_company')) {
mkdir(ATTACHMENT_ROOT . '/' . 'images/longbing_company');
}
if (!is_dir(ATTACHMENT_ROOT . '/' . ('images/longbing_company/' . $_W['uniacid'] . '/'))) {
mkdir(ATTACHMENT_ROOT . '/' . ('images/longbing_company/' . $_W['uniacid'] . '/'));
}
$destination_folder = ATTACHMENT_ROOT . '/images' . ('/longbing_company/' . $_W['uniacid']);
$image = $destination_folder . '/' . $_W['uniacid'] . '-' .$order['id'] .'qr.png';
$path = '/longbing_company/users/pages/uCenter/order/orderDetail/orderDetail?orderId='.$order_id;
$res = $this->createQr($image, $path);
$image = tomedia('images' . ('/longbing_company/' . $_W['uniacid'] . '/') . $_W['uniacid'] . '-' .$order['id']. 'qr.png');
if (!strstr($image, 'ttp')) {
$image = 'https://' . $image;
}
//pdo_update('longbing_company_user', array('qr_path' => 'images' . ('/longbing_company/' . $_W['uniacid'] . '/') . $_W['uniacid'] . '-' . $to_uid . 'qr.png'), array('id' => $to_uid));
$image = $this->transImage($image);
if(!empty($image)) {
pdo_update('longbing_company_shop_order_item',array('qr_code'=>$image),array('order_id'=>$order['id']));
pdo_update('longbing_company_shop_order',array('qr_code'=>$image),array('id'=>$order['id']));
//return $this->result(0, '成功生成二维码', $image, array());
//print_r($image);die;
}
return $this->result(-1, '生成二维码失败', array());
}
return false;
......@@ -10063,6 +10097,75 @@ class longbing_companyModuleWxapp extends WeModuleWxapp
{
exit(json_encode(array('errno' => $errno, 'message' => $message, 'data' => $data), JSON_UNESCAPED_UNICODE));
}
function getAccessToken2()
{
global $_GPC;
global $_W;
$appid = $_W['account' ]['key'];
$appsecret = $_W['account']['secret'];
$appidMd5 = md5($appid);
if (!is_file(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt')) {
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret;
$data = ihttp_get($url);
$data = json_decode($data['content'], true);
if (!isset($data['access_token'])) {
return false;
}
$access_token = $data['access_token'];
file_put_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt', json_encode(array('at' => $access_token, 'time' => time() + 6200)));
return $access_token;
}
if (is_file(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt')) {
$fileInfo = file_get_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt');
if (!$fileInfo) {
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret;
$data = ihttp_get($url);
$data = json_decode($data['content'], true);
if (!isset($data['access_token'])) {
return false;
}
$access_token = $data['access_token'];
file_put_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt', json_encode(array('at' => $access_token, 'time' => time() + 6200)));
return $access_token;
}
$fileInfo = json_decode($fileInfo, true);
if ($fileInfo['time'] < time()) {
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret;
$data = ihttp_get($url);
$data = json_decode($data['content'], true);
if (!isset($data['access_token'])) {
return false;
}
$access_token = $data['access_token'];
file_put_contents(IA_ROOT . '/data/tpl/web/' . $appidMd5 . '.txt', json_encode(array('at' => $access_token, 'time' => time() + 6200)));
return $access_token;
}
return $fileInfo['at'];
}
return false;
}
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment