|
|
@@ -36,6 +36,8 @@ class Goodimglibrary extends Start_Controller {
|
|
|
$this->_getgoodbyids();
|
|
|
}elseif($arg == 'excelgood'){
|
|
|
$this->_excelgood();
|
|
|
+ }elseif($arg == 'editsku'){
|
|
|
+ $this->_editsku();
|
|
|
}else{
|
|
|
$this->_index();
|
|
|
}
|
|
|
@@ -391,6 +393,8 @@ class Goodimglibrary extends Start_Controller {
|
|
|
return $u9_jm;
|
|
|
}
|
|
|
private function _indexnoimg(){
|
|
|
+ $user = $this->user->get_api($_SESSION['api']);
|
|
|
+ $user_id = $user['id'];
|
|
|
if($this->input->method() == 'post'){
|
|
|
$page = $this->input->post('page',true);
|
|
|
$perpage = $this->input->post('perpage',true);
|
|
|
@@ -483,11 +487,20 @@ class Goodimglibrary extends Start_Controller {
|
|
|
$where .= ' AND features LIKE "%'.trim($hairnumber).'%" ';
|
|
|
}
|
|
|
|
|
|
+ $is_able_edit = 0;
|
|
|
+ if(in_array($user_id,[10,28])){
|
|
|
+ $is_able_edit = 1;
|
|
|
+ }
|
|
|
$list = $this->goods->find_all($where,'id,sku,title,zh,jm,update_time','id DESC',$start,$perpage);
|
|
|
$info_list = [];
|
|
|
foreach($list as $k => $v){
|
|
|
$info_list[$k]['id'] = $v['id'];
|
|
|
- $info_list[$k]['sku'] = $v['sku']." <i class='fa fa-copy' data-text='".$v['sku']."' onclick='fuzhi(this)' style='background-color:#FFE4C4'></i>";
|
|
|
+ if($is_able_edit == 1){
|
|
|
+ $info_list[$k]['sku'] = " <i class='fa fa-edit' data-id ='".$v['id']."' data-sku='".$v['sku']."' onclick='editsku(this)' style='color:red'></i> ".$v['sku']." <i class='fa fa-copy' data-text='".$v['sku']."' onclick='fuzhi(this)' style='background-color:#FFE4C4'></i>";
|
|
|
+ }else{
|
|
|
+ $info_list[$k]['sku'] = $v['sku']." <i class='fa fa-copy' data-text='".$v['sku']."' onclick='fuzhi(this)' style='background-color:#FFE4C4'></i>";
|
|
|
+ }
|
|
|
+
|
|
|
$info_list[$k]['title'] = $v['title']." <i class='fa fa-copy' data-text='".$v['title']."' onclick='fuzhi(this)' style='background-color:#FFE4C4'></i>";
|
|
|
$info_list[$k]['zh'] = $v['zh']." <i class='fa fa-copy' data-text='".$v['zh']."' onclick='fuzhi(this)' style='background-color:#FFE4C4'></i>";
|
|
|
$info_list[$k]['jm'] = $v['jm']." <i class='fa fa-copy' data-text='".$v['jm']."' onclick='fuzhi(this)' style='background-color:#FFE4C4'></i>";
|
|
|
@@ -868,4 +881,25 @@ class Goodimglibrary extends Start_Controller {
|
|
|
echo json_encode(['success'=>false,'msg'=>'请求不合法']);exit;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private function _editsku(){
|
|
|
+ if($this->input->method() == 'post'){
|
|
|
+ $id = $this->input->post('id',true);
|
|
|
+ $sku = $this->input->post('sku',true);
|
|
|
+ $info = $this->goods->read($id);
|
|
|
+ if(empty($info)){
|
|
|
+ echo json_encode(['success'=>false,'msg'=>'料品不存在']);exit;
|
|
|
+ }
|
|
|
+ if($info['sku'] == $sku){
|
|
|
+ echo json_encode(['success'=>false,'msg'=>'料品SKU未变动']);exit;
|
|
|
+ }
|
|
|
+ if($this->goods->save(array('sku'=>$sku),$id)){
|
|
|
+ echo json_encode(['success'=>true,'msg'=>'料品SKU修改成功']);exit;
|
|
|
+ }else{
|
|
|
+ echo json_encode(['success'=>false,'msg'=>'料品SKU修改失败']);exit;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ echo json_encode(['success'=>false,'msg'=>'请求不合法']);exit;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|