Commit 4f02dcaf authored by chenzq's avatar chenzq

会员功能添加

parent 229b47eb
......@@ -2,6 +2,7 @@
//dezend by http://www.yunlu99.com/
global $_GPC;
global $_W;
$goods_id=$_GPC['id'];
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';
......@@ -11,6 +12,13 @@ $redis_sup_v3 = false;
$redis_server_v3 = false;
include_once $_SERVER['DOCUMENT_ROOT'] . '/addons/longbing_company/images/phpqrcode/func_longbing.php';
//print_r($goods_id);
//$a= pdo_getall('longbing_company_shop_spe',array('goods_id'=>$goods_id));
//print_r($a);
//
//die;
if (function_exists('longbing_check_redis')) {
$config = $_W['config']['setting']['redis'];
$password = '';
......@@ -22,12 +30,17 @@ if (function_exists('longbing_check_redis')) {
list($redis_sup_v3, $redis_server_v3) = longbing_check_redis($config['server'], $config['port'], $password);
}
}
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";
$list=pdo_fetchall($sql);
return $list;
}
function updateCompany($ids,$good_id){
if(!$ids){
......@@ -58,14 +71,12 @@ if ($_GPC['action'] == 'edit') {
foreach ($_GPC['formData'] as $k => $v) {
if (strpos($k, 'mages')) {
$data['images'][] = $v;
}
else {
if($k=='ids'){
} else {
if ($k == 'ids') {
continue;
}elseif($k=='city'||$k=='province'){
continue;
}
else{
} elseif ($k == 'city' || $k == 'province') {
continue;
} else {
$data[$k] = $v;
}
......@@ -73,8 +84,7 @@ if ($_GPC['action'] == 'edit') {
}
if (isset($data['images'])) {
$data['images'] = implode(',', $data['images']);
}
else {
} else {
$data['images'] = '';
}
......@@ -84,14 +94,16 @@ if ($_GPC['action'] == 'edit') {
$data['type_p'] = $type['pid'] ? $type['pid'] : $type['id'];
$id = $_GPC['id'];
$result = false;
if ($id) {
$result = pdo_update('longbing_company_goods', $data, array('id' => $id));
//$re = pdo_get('longbing_company_shop_type',array('id'=>$data['type']));
$destination_folder = ATTACHMENT_ROOT . '/images' . ('/longbing_company/' . $_W['uniacid']);
$image2 = $destination_folder . '/' . $_W['uniacid'] . '-goods-' . $id . '.png';
@unlink($image2);
$good_id=$id;
}
else {
$good_id = $id;
} else {
if (LONGBING_AUTH_GOODS) {
$list = pdo_getall('longbing_company_goods', array('uniacid' => $_W['uniacid'], 'status >' => -1));
$count = count($list);
......@@ -104,7 +116,7 @@ if ($_GPC['action'] == 'edit') {
$data['create_time'] = time();
$data['uniacid'] = $_W['uniacid'];
$result = pdo_insert('longbing_company_goods', $data);
$good_id=pdo_insertid();
$good_id = pdo_insertid();
}
if ($result && !$id) {
......@@ -115,8 +127,8 @@ if ($_GPC['action'] == 'edit') {
$spe_id = pdo_insertid();
pdo_insert('longbing_company_shop_spe_price', array('goods_id' => $goodsId, 'uniacid' => $_W['uniacid'], 'spe_id_1' => $spe_id, 'create_time' => time(), 'update_time' => time(), 'price' => $data['price'], 'stock' => $data['stock']));
}
updateCompany($_GPC['ids'],$good_id);
updateCompany($_GPC['ids'],$good_id);
if ($result) {
if ($redis_sup_v3) {
......@@ -126,10 +138,9 @@ if ($_GPC['action'] == 'edit') {
if (!$id) {
message('操作成功,请前往编辑商品规格', $this->createWebUrl('manage/goods'), 'success');
}
message('操作成功', $this->createWebUrl('manage/goods'), 'success');
}
}
message('操作失败', '', 'error');
}
......@@ -147,6 +158,9 @@ if (isset($_GPC['id'])) {
}
}
$typeList = pdo_getall('longbing_company_shop_type', array('status' => 1, 'uniacid' => $_W['uniacid']));
foreach ($typeList as $k => $v) {
if ($v['pid'] != 0) {
......@@ -168,4 +182,4 @@ foreach ($typeList as $k => $v) {
load()->func('tpl');
include $this->template('manage/goodsEdit');
?>
?>
\ No newline at end of file
<?php
//dezend by http://www.yunlu99.com/
global $_GPC;
global $_W;
define('ROOT_PATH', IA_ROOT . '/addons/' . $_W['current_module']['name'] . '/');
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'];
$companyEdit = $this->createWebUrl('manage/member');
$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);
}
}
$limit = array(1, 15);
$curr = 1;
if (isset($_GPC['page'])) {
$limit[0] = $_GPC['page'];
$curr = $_GPC['page'];
}
$company = pdo_getslice('longbing_company_user',array('level_id >'=>'0'),$limit,$count);
//$company = pdo_getslice('longbing_company_member_level', $where, $limit, $count);
$perPage = 15;
load()->func('tpl');
include $this->template('manage/member');
?>
......@@ -82,19 +82,18 @@ if ($_GPC['action'] == 'delete') {
message('删除失败', '', 'error');
}
if($_GPC['action']=='region'){
$parent_id= isset($_GPC["id"])?$_GPC["id"]:1;
$sql = "select * from ".tablename('sys_region')." where parent_id =".$parent_id;
$list=pdo_fetchall($sql);
exit(json_encode(array('errno'=>0,'message'=>'','data'=>$list)));
}
if ($_GPC['action'] == 'edit') {
$time = time();
foreach ($_GPC['formData'] as $k => $v) {
$data[$k] = $v;
}
$id = $_GPC['id'];
$result = false;
......@@ -103,17 +102,18 @@ if ($_GPC['action'] == 'edit') {
}
else {
$result = pdo_insert('longbing_company_member_level', $data);
}
if ($result) {
if ($redis_sup_v3) {
$redis_server_v3->flushDB();
}
message('编辑成功', $this->createWebUrl('manage/memberlevel'), 'success');
}
message('编辑失败', '', 'error');
}
$limit = array(1, 15);
......@@ -124,6 +124,7 @@ if (isset($_GPC['page'])) {
$limit[0] = $_GPC['page'];
$curr = $_GPC['page'];
}
$company = pdo_getslice('longbing_company_member_level', $where, $limit, $count);
$perPage = 15;
......
......@@ -10,11 +10,14 @@ $module_name = $_W['current_module']['name'];
$id = $_GPC['id'];
$company = array();
if ($id) {
$company = pdo_get('longbing_company_member_level', array('id' => $id));
if (!$company || empty($company)) {
$id = 0;
}
$company = pdo_get('longbing_company_member_level', array('id' => $id));
if (!$company || empty($company)) {
$id = 0;
}
}
load()->func('tpl');
include $this->template('manage/memberLevelEdit');
......
......@@ -89,6 +89,11 @@ if ($info['type'] == 1) {
}
}
if ($result) {
changeWater($id);
/*if(checkFreeCard($id)){
......
......@@ -118,8 +118,8 @@ if (!isset($_GPC['id'])) {
$where['id'] = $_GPC['id'];
$id = $_GPC['id'];
$where = array('uniacid' => $_W['uniacid'], 'goods_id' => $id, 'status' => 1);
$where2 = array('uniacid' => $_W['uniacid'], 'goods_id' => $id, 'status' => 1, 'title !=' => '默认');
$list = pdo_getall('longbing_company_shop_spe', $where2);
//$where2 = array('uniacid' => $_W['uniacid'], 'goods_id' => $id, 'status' => 1, 'title !=' => '默认');
$list = pdo_getall('longbing_company_shop_spe', $where);
$data = array();
foreach ($list as $k => $v) {
......@@ -128,6 +128,7 @@ foreach ($list as $k => $v) {
}
}
foreach ($list as $k => $v) {
foreach ($data as $k2 => $v2) {
if ($v2['id'] == $v['pid']) {
......
......@@ -51,7 +51,7 @@ else {
$province = pdo_getall('sys_region',array('parent_id'=> 1));
$parent_id = isset($_GPC["agency_id"])?$_GPC["agency_id"]:1;
//$city= pdo_getall('sys_region',array('agency_id'=>$agency_id));
$type=pdo_getall('sys_region',array('parent_id'=>$parent_id,'type'=>2));
$type=pdo_getall('sys_region',array('parent_id'=>$parent_id));
$city_id = isset($_GPC["id"])?$_GPC["id"]:1;
//$company = pdo_getall('longbing_company_company',array('uniacid' => $_W['uniacid'], 'status' => 1,'id'=>$city));
......
......@@ -46,9 +46,9 @@ $encryptedData = $_GPC['encryptedData'];
$iv = $_GPC['iv'];
$this->checkEmpty();
if (!$code) {
/*if (!$code) {
return $this->result(-1, 'need code', array());
}
}*/
if (!$pid) {
$pid = 0;
......@@ -188,7 +188,14 @@ if (isset($info['openid'])) {
@pdo_update('longbing_company_user_sk', array('sk' => $session_key, 'update_time' => $time), array('id' => $check_sk['id']));
}
return $this->result(0, 'suc', array('user_id' => $uid, 'user' => $user));
$sq = 'SELECT a.level_id,b.icon FROM ' . tablename('longbing_company_user') . ' a LEFT JOIN ' . tablename('longbing_company_member_level') . (' b ON a.level_id = b.level WHERE a.id = ' . $uid);
$a =pdo_fetch($sq);
if($a&&$a['icon']){
$a['icon']=$_W['siteroot'].$a['icon'];
}
@file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/data/tpl/icon.txt','x',$a);
return $this->result(0, 'suc', array('user_id' => $uid, 'user' => $user,'inf'=>$a));
}
return $this->result(-2, json_decode($info), $info);
......
<?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;
$ab = pdo_getall('longbing_company_member_level','',array('discount','name'));
return $this->result(0, '',$ab, array());
?>
\ No newline at end of file
......@@ -77,6 +77,7 @@ if ($info['order_status'] != 2) {
return $this->result(-1, '', array());
}
$result = pdo_update('longbing_company_shop_order', array('order_status' => 3), $where);
if ($info['type'] == 1) {
......@@ -91,10 +92,16 @@ if ($result) {
changeWater($id);
if(checkFreeCard($id)){
pdo_update('longbing_company_user', array('is_pay' => 1,'is_staff'=>1), array('id' => $uid));
}
return $this->result(0, '', array());
}
return $this->result(-1, '', array());
?>
......@@ -8,6 +8,9 @@ global $_W;
$uid = $_GPC['user_id'];
$type_id = $_GPC['type_id'];
$type = pdo_get('longbing_company_shop_type', array('id' => $type_id));
if (empty($type) && $type != 0) {
return $this->result(-1, '', array());
}
......@@ -16,26 +19,71 @@ $uniacid = $_W['uniacid'];
$limit = array(1, $this->limit);
$curr = 1;
if (isset($_GPC['page'])) {
$limit[0] = $_GPC['page'];
$curr = $_GPC['page'];
}
$is_level = pdo_get('longbing_company_user',array('id'=>$uid));
if ($type == 0) {
$list = pdo_getslice('longbing_company_goods', array('uniacid' => $uniacid, 'status' => 1), $limit, $count, array('id', 'name', 'cover', 'top', 'recommend', 'price', 'is_collage', 'unit'), '', array('recommend desc', 'top desc', 'id desc'));
}
else if ($type['pid'] == 0) {
$list = pdo_getslice('longbing_company_goods', array('uniacid' => $uniacid, 'status' => 1, 'type_p' => $type_id), $limit, $count, array('id', 'name', 'cover', 'top', 'recommend', 'price', 'is_collage', 'unit'), '', array('recommend desc', 'top desc', 'id desc'));
}
else {
$list = pdo_getslice('longbing_company_goods', array('uniacid' => $uniacid, 'status' => 1, 'type' => $type_id), $limit, $count, array('id', 'name', 'cover', 'top', 'recommend', 'price', 'is_collage', 'unit'), '', array('recommend desc', 'top desc', 'id desc'));
}
$number = $is_level['level_id'];
foreach ($list as $k => $v) {
$list[$k]['trueCover'] = tomedia($v['cover']);
}
$data = array('page' => $curr, 'total_page' => ceil($count / $this->limit), 'list' => $list);
return $this->result(0, '', $data);
if (isset($_GPC['page'])) {
$limit[0] = $_GPC['page'];
$curr = $_GPC['page'];
}
if ($type == 0) {
$list = pdo_getslice('longbing_company_goods', array('uniacid' => $uniacid, 'status' => 1), $limit, $count, array('id', 'name', 'cover', 'top', 'recommend', 'price', 'is_collage', 'unit','is_discount'), '', array('recommend desc', 'top desc', 'id desc'));
} else if ($type['pid'] == 0) {
$list = pdo_getslice('longbing_company_goods', array('uniacid' => $uniacid, 'status' => 1, 'type_p' => $type_id), $limit, $count, array('id', 'name', 'cover', 'top', 'recommend', 'price', 'is_collage', 'unit','is_discount'), '', array('recommend desc', 'top desc', 'id desc'));
} else {
$list = pdo_getslice('longbing_company_goods', array('uniacid' => $uniacid, 'status' => 1, 'type' => $type_id), $limit, $count, array('id', 'name', 'cover', 'top', 'recommend', 'price', 'is_collage', 'unit','is_discount'), '', array('recommend desc', 'top desc', 'id desc'));
}
foreach ($list as $k => $v) {
$list[$k]['trueCover'] = tomedia($v['cover']);
if($number<1){
$list[$k]['m_price'] = 0;
$list[$k]['member']=0;
}
else{
$le = pdo_get('longbing_company_member_level', array('level' => $number));
$discount = $le['discount'];
if($v['is_discount']==1){
if($v['price']){
$m_price=$v['price']*$discount/100;
$list[$k]['m_price'] =sprintf('%.2f',$m_price);
$list[$k]['member']=1;
}
}else{
$list[$k]['m_price'] = 0;
}
}
}
$data = array('page' => $curr, 'total_page' => ceil($count / $this->limit), 'list' => $list);
return $this->result(0, '', $data);
print_r($price);die;
pdo_update('longbing_company_goods',$price,'discount_price');
if (isset($_GPC['page'])) {
$limit[0] = $_GPC['page'];
$curr = $_GPC['page'];
}
if ($type == 0) {
$list = pdo_getslice('longbing_company_goods', array('uniacid' => $uniacid, 'status' => 1), $limit, $count, array('id', 'name', 'cover', 'top', 'recommend','discount_price', 'price', 'is_collage', 'unit'), '', array('recommend desc', 'top desc', 'id desc'));
} else if ($type['pid'] == 0) {
$list = pdo_getslice('longbing_company_goods', array('uniacid' => $uniacid, 'status' => 1, 'type_p' => $type_id), $limit, $count, array('id', 'name', 'cover', 'top', 'recommend','discount_price', 'price', 'is_collage', 'unit'), '', array('recommend desc', 'top desc', 'id desc'));
} else {
$list = pdo_getslice('longbing_company_goods', array('uniacid' => $uniacid, 'status' => 1, 'type' => $type_id), $limit, $count, array('id', 'name', 'cover', 'top', 'recommend', 'discount_price','price', 'is_collage', 'unit'), '', array('recommend desc', 'top desc', 'id desc'));
}
foreach ($list as $k => $v) {
$list[$k]['trueCover'] = tomedia($v['cover']);
}
$data = array('page' => $curr, 'total_page' => ceil($count / $this->limit), 'list' =>$list);
return $this->result(0, '', $data);
?>
......@@ -9,6 +9,9 @@ $uniacid = $_W['uniacid'];
$uid = $_GPC['user_id'];
$type = $_GPC['type'];
if (!$type) {
$type = 0;
}
......@@ -55,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.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.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);
$goods_info = pdo_fetchall($sql);
foreach ($goods_info as $k2 => $v2) {
......
......@@ -2,12 +2,14 @@
//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());
}
......@@ -48,11 +50,15 @@ if ($info['pay_status'] == 0 && $info['order_status'] != 1) {
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);
......
......@@ -15,6 +15,9 @@ $record_id = $_GPC['record_id'];
$direct = $_GPC['direct'];
$number = $_GPC['number'];
$trolley_arr = explode(',', $trolley_ids);
/*if (!$address_id || empty($trolley_arr)) {
return $this->result(-1, '', array());
}*/
......@@ -27,6 +30,8 @@ if (empty($address)) {
return $this->result(-1, '', array());
}*/
$trolley_in = '(' . $trolley_ids . ')';
if (1 < count($trolley_arr)) {
......@@ -124,7 +129,7 @@ if (!empty($result)) {
$order_id = pdo_insertid();
foreach ($list as $k => $v) {
$insertItem = array('order_id' => $order_id, 'goods_id' => $v['goods_id'], 'name' => $v['name'], 'cover' => $v['cover'], 'spe_price_id' => $v['spe_price_id'], 'content' => $v['spe'], 'number' => $v['number'], 'price' => $v['price'], 'uniacid' => $uniacid, 'create_time' => $time, 'update_time' => $time,'company_id' => $v['company_id'],'trip_time' => $v['trip_time'],'company_name' => $v['company_name']);
$insertItem = array('order_id' => $order_id, 'goods_id' => $v['goods_id'], 'name' => $v['name'], 'cover' => $v['cover'], 'spe_price_id' => $v['spe_price_id'], 'content' => $v['spe'], 'number' => $v['number'], 'price' => $v['price'], 'uniacid' => $uniacid, 'create_time' => $time, 'update_time' => $time,'company_id' => $v['company_id'],'trip_time' => $v['trip_time'],'company_name' => $v['company_name'],$uid);
$result = pdo_insert('longbing_company_shop_order_item', $insertItem);
}
......
......@@ -10,16 +10,17 @@ $uid = $_GPC['user_id'];
$uniacid = $_W['uniacid'];
$to_uid = $_GPC['to_uid'];
if ($this->redis_sup_v3) {
$redis_key = 'longbing_company_shoptypes_' . $to_uid . '_' . $uniacid;
$data = $this->redis_server_v3->get($redis_key);
if ($data) {
$data = json_decode($data, true);
$data['from_redis'] = 1;
return $this->result(0, '', $data);
}
}
//if ($this->redis_sup_v3) {
// $redis_key = 'longbing_company_shoptypes_' . $to_uid . '_' . $uniacid;
// $data = $this->redis_server_v3->get($redis_key);
//
// if ($data) {
// $data = json_decode($data, true);
// $data['from_redis'] = 1;
// return $this->result(0, '', $data);
// }
//}
$list = pdo_getall('longbing_company_shop_type', array('uniacid' => $uniacid, 'status' => 1), array('id', 'title', 'pid', 'top', 'cover'), '', array('top desc', 'id desc'));
$data = array();
......@@ -31,6 +32,7 @@ foreach ($list as $k => $v) {
}
}
foreach ($list as $k => $v) {
if ($v['pid'] != 0) {
$v['cover_true'] = tomedia($v['cover']);
......@@ -38,32 +40,88 @@ foreach ($list as $k => $v) {
if (isset($data[$v['pid']])) {
$data[$v['pid']]['sec'][] = $v;
}
}
}
}
array_multisort(array_column($data, 'top'), SORT_DESC, $data);
$limit = array(1, 10);
$is_level = pdo_get('longbing_company_user',array('id'=>$uid));
$number = $is_level['level_id'];
foreach ($data as $k => $v) {
if (!isset($v['sec'])) {
$goods = pdo_getslice('longbing_company_goods', array('uniacid' => $uniacid, 'status' => 1, 'type_p' => $v['id']), array(1, 9), $count, array('id', 'name', 'cover', 'top', 'recommend', 'price', 'is_collage', 'unit'), '', array('recommend desc', 'top desc', 'id desc'));
$goods = pdo_getslice('longbing_company_goods', array('uniacid' => $uniacid, 'status' => 1, 'type_p' => $v['id']), array(1, 9), $count, array('id', 'name', 'cover', 'top', 'recommend', 'price', 'is_collage', 'unit', 'is_discount'), '', array('recommend desc', 'top desc', 'id desc'));
foreach ($goods as $k2 => $v2) {
$goods[$k2]['cover_true'] = tomedia($v2['cover']);
if($number<1){
$goods[$k2]['m_price']=0;
$goods[$k2]['member']=0;
}else{
$le = pdo_get('longbing_company_member_level', array('level' => $number));
$discount = $le['discount'];
if($v2['is_discount']==1) {
if ($v2['price']) {
$m_price = $v2['price'] * $discount / 100;
$goods[$k2]['m_price'] = sprintf('%.2f', $m_price);
$goods[$k2]['member'] = 1;
}
}else {
$goods[$k2]['m_price'] = 0;
}
}
}
$data[$k]['goods'] = $goods;
}
$data[$k]['goods'] = $goods;
}
}
$data2['shop_type'] = $data;
$data = $data2;
$list = pdo_getslice('longbing_company_goods', array('uniacid' => $uniacid, 'status' => 1), $limit, $count, array('id', 'name', 'cover', 'top', 'recommend', 'price', 'is_collage', 'unit'), '', array('recommend desc', 'top desc', 'id desc'));
$list = pdo_getslice('longbing_company_goods', array('uniacid' => $uniacid, 'status' => 1), $limit, $count, array('id', 'name', 'cover', 'top', 'recommend', 'price', 'is_collage', 'unit','is_discount'), '', array('recommend desc', 'top desc', 'id desc'));
$iyy = pdo_get('longbing_company_user',array('id'=>$uid));
$nu = $iyy['level_id'];
foreach ($list as $index => $item) {
$list[$index]['trueCover'] = tomedia($item['cover']);
if($nu<1){
$list[$index]['m_price'] = 0;
$list[$index]['member']=0;
}
else{
$lu = pdo_get('longbing_company_member_level', array('level' => $nu));
$dis = $lu['discount'];
if($item['is_discount']==1){
if($item['price']){
$m_price=$item['price']*$dis/100;
$list[$index]['m_price'] =sprintf('%.2f',$m_price);
$list[$index]['member']=1;
}
}else{
$list[$index]['m_price'] = 0;
}
}
}
$dataALl = array('page' => 1, 'total_page' => ceil($count / 10), 'list' => $list);
$data['shop_all'] = $dataALl;
$companyList = pdo_getall('longbing_company_company', array('status' => 1, 'uniacid' => $uniacid));
......@@ -93,11 +151,11 @@ $company['logo'] = tomedia($company['logo']);
$company['desc'] = tomedia($company['desc']);
$data['shop_company'] = $company;
if ($this->redis_sup_v3) {
$redis_key = 'longbing_company_shoptypes_' . $to_uid . '_' . $uniacid;
$this->redis_server_v3->set($redis_key, json_encode($data));
$this->redis_server_v3->EXPIRE($redis_key, 30 * 60);
}
//if ($this->redis_sup_v3) {
// $redis_key = 'longbing_company_shoptypes_' . $to_uid . '_' . $uniacid;
// $this->redis_server_v3->set($redis_key, json_encode($data));
// $this->redis_server_v3->EXPIRE($redis_key, 30*2);
//}
$this->insertView($uid, $to_uid, 1, $_W['uniacid']);
return $this->result(0, '', $data);
......
......@@ -18,6 +18,7 @@ $data = '<xml>
<sign>' . $string . '</sign>
</xml>';
$xml = $this->curlPost($url, $data);
var_dump($_W['account']['setting']['payment']['wechat']);
var_dump($xml);
......
......@@ -60,6 +60,7 @@ class longbing_companyModule extends WeModule
$goodsList = $this->createWebUrl('manage/goods');
$levelList = $this->createWebUrl('manage/memberLevel');
$leveledit = $this->createWebUrl('manage/memberLeveledit');
$member = $this->createWebUrl('manage/member');
$addGoods = $this->createWebUrl('manage/goodsEdit');
$orderList = $this->createWebUrl('manage/orders');
$timelineList = $this->createWebUrl('manage/timeline');
......
......@@ -152,7 +152,6 @@
<span class="span-remark">商品单位,如:个、件、瓶、套等</span>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序值</label>
<div class="layui-input-block">
......@@ -262,9 +261,9 @@
}
$("select[name='city']").html(html);
form.render('select');
getSelectCompany(e[0].id)
//getSelectCompany(e[0].id)
}
//获取公司
获取公司
function getSelectCompany(id){
ajaxFun({
url:"{php echo $this->createWebUrl('manage/goodsedit')}",
......@@ -354,6 +353,68 @@
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">购买设为会员</label>
<div class="layui-input-block">
{if $info['is_free_card'] == 1}
<input type="radio" name="is_free_card" value="1" title="是" checked>
<input type="radio" name="is_free_card" value="0" title="否">
{else}
<input type="radio" name="is_free_card" value="1" title="是">
<input type="radio" name="is_free_card" value="0" title="否" checked>
{/if}
<span class="span-remark">设为购买成为会员</span>
</div>
<div class="layui-form-item">
<label class="layui-form-label">购物成为等级会员</label>
<div class="layui-input-block">
{if $info['leve_id']==0}
<input type="radio" name="leve_id" value="0" title="0" checked >
<input type="radio" name="leve_id" value="1" title="1" >
<input type="radio" name="leve_id" value="2" title="2">
<input type="radio" name="leve_id" value="3" title="3">
<span class="span-remark">0:不是会员 1:普通会员 2:会员 3:钻石会员</span>
{elseif $info['leve_id']==1}
<input type="radio" name="leve_id" value="0" title="0" >
<input type="radio" name="leve_id" value="1" title="1"checked >
<input type="radio" name="leve_id" value="2" title="2">
<input type="radio" name="leve_id" value="3" title="3">
<span class="span-remark">0:不是会员 1:普通会员 2:会员 3:钻石会员</span>
{elseif $info['leve_id']==2}
<input type="radio" name="leve_id" value="0" title="0" >
<input type="radio" name="leve_id" value="1" title="1" >
<input type="radio" name="leve_id" value="2" title="2" checked>
<input type="radio" name="leve_id" value="3" title="3">
<span class="span-remark">0:不是会员 1:普通会员 2:会员 3:钻石会员</span>
{elseif $info['leve_id']==3}
<input type="radio" name="leve_id" value="0" title="0" >
<input type="radio" name="leve_id" value="1" title="1" >
<input type="radio" name="leve_id" value="2" title="2" >
<input type="radio" name="leve_id" value="3" title="3"checked>
<span class="span-remark">0:不是会员 1:普通会员 2:会员 3:钻石会员</span>
{/if}
</div>
<div class="layui-form-item">
<label class="layui-form-label">设为折扣</label>
<div class="layui-input-block">
{if $info['is_discount'] == 1}
<input type="radio" name="is_discount" value="1" title="是" checked>
<input type="radio" name="is_discount" value="0" title="否">
{else}
<input type="radio" name="is_discount" value="1" title="是">
<input type="radio" name="is_discount" value="0" title="否" checked>
{/if}
<span class="span-remark">设为推荐则该商品折扣价</span>
</div>
</div>
<!--<div class="layui-form-item">-->
<!--<label class="layui-form-label">商品简介</label>-->
<!--<div class="layui-input-block">-->
......
......@@ -209,7 +209,7 @@
<a lay-href="{$levelList}" style="color: #898989">等级折扣列表</a>
</dd>
<dd data-name="console4">
<a lay-href="{$leveledit}" style="color: #898989">添加等级折扣</a>
<a lay-href="{$member}" style="color: #898989">会员列表</a>
</dd>
</dl>
</li>
......
<!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">
<table class="layui-table">
<thead>
<tr>
<th>会员ID</th>
<th>会员姓名</th>
<th>等级</th>
</tr>
</thead>
<tbody>
{loop $company $item}
<tr>
<td>{$item['id']}</td>
<td>{$item['nickName']}</td>
<td>{$item['level_id']}</td>
</tr>
{/loop}
</tbody>
</table>
<div id="dataTable"></div>
</div>
</div>
</div>
</div>
</div>
<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();
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包含了当前分页的所有参数,比如:
console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
//首次不执行
if (!first) {
//do something
layer.load();
window.location.href = "{php echo $this->createWebUrl('manage/company')}" + "&page=" + obj.curr + "&keyword=" + keyword;
// window.location.href = "{php echo $this->createWebUrl('cards')}" + "&page=" + obj.curr;
}
}
});
});
// 删除
$('.btn-delete-item').click(function () {
var id = $(this).attr('itemId');
if (!id) {
layer.msg('获取参数失败!');
return false;
}
layer.open({
content: '是否删除?',
yes: function (index, layero) {
layer.close(index); //如果设定了yes回调,需进行手工关闭
layer.load();
var url = "{php echo $this->createWebUrl('manage/company')}";
var data = {
action: 'delete',
id: id
};
postData(url, data);
}
});
});
// 编辑
$('.btn-edit-item').click(function () {
var id = $(this).attr('itemId');
if (!id) {
layer.msg('获取参数失败!');
return false;
}
layer.load();
var url = "{php echo $this->createWebUrl('manage/memberLevelEdit')}" + "&id=" +id;
window.location.href = url;
});
// 提交
var uploading;
function btnUpload (obj)
{
if(uploading){
alert("文件正在上传中,请稍候");
return false;
}
layer.load();
file = obj.files[0]
var form = new FormData(); // FormData 对象
form.append("file", file);
form.append("action", "import");
var url = "{php echo $this->createWebUrl('manage/excel')}";
$.ajax({
url: url,
type: 'POST',
cache: false,
data: form,
processData: false,
contentType: false,
dataType:"json",
beforeSend: function(){
uploading = true;
},
success : function(data) {
alert(data.message);
//layer.msg(data.message);
uploading = false;
layer.closeAll();
}
});
return false;
}
</script>
<script src="../../../addons/{$module_name}/images/js/main.js"></script>
</body>
</html>
......@@ -46,7 +46,9 @@
<tr>
<td>{$item['id']}</td>
<td>{$item['name']}</td>
<td>{$item['icon']}</td>
<td>
<img src="{php echo tomedia($item['icon'])}" alt="" />
</td>
<td>{$item['level']}</td>
<td>{$item['describe']}</td>
<td>{$item['discount']}</td>
......
......@@ -62,33 +62,34 @@
<div class="layui-form-item">
<label class="layui-form-label">等级名称</label>
<div class="layui-input-block">
<input type="text" name="name" required lay-verify="required" placeholder="请输入公司名称" autocomplete="off" class="layui-input" value="{$company['name']}">
<input type="text" name="name" required placeholder="请输入公司名称" autocomplete="off" class="layui-input" value="{$company['name']}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图标</label>
<div class="layui-input-block">
<input type="text" name="icon" required lay-verify="required" placeholder="请输入公司简称" autocomplete="off" class="layui-input" value="{$company['icon']}">
{php echo tpl_form_field_image('icon', $company['icon']);}
<span class="span-remark">图片建议尺寸: 750 * 699</span>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">等级</label>
<div class="layui-input-block">
<input type="text" name="level" required lay-verify="required" placeholder="请输入公司地址" autocomplete="off" class="layui-input" value="{$company['level']}">
<input type="text" name="level" required placeholder="请输入公司地址" autocomplete="off" class="layui-input" value="{$company['level']}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">说明</label>
<div class="layui-input-block">
<input type="text" name="describe" required lay-verify="required" placeholder="请输入说明" autocomplete="off" class="layui-input" value="{$company['describe']}">
<input type="text" name="describe" required placeholder="请输入说明" autocomplete="off" class="layui-input" value="{$company['describe']}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">折扣</label>
<div class="layui-input-block">
<input type="text" name="discount" required lay-verify="required" placeholder="请输入折扣" autocomplete="off" class="layui-input" value="{$company['discount']}">
<input type="text" name="discount" required placeholder="请输入折扣" autocomplete="off" class="layui-input" value="{$company['discount']}">
</div>
</div>
<div class="layui-form-item">
......
This diff is collapsed.
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