sjaddgoods.inc.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. global $_GPC, $_W;
  3. $storeid=$_COOKIE["storeid"];
  4. $cur_store = $this->getStoreById($storeid);
  5. $GLOBALS['frames'] = $this->getNaveMenu2($storeid);
  6. $sys=pdo_get('zhtc_system',array('uniacid'=>$_W['uniacid']),'is_goods');
  7. $info=pdo_get('zhtc_goods',array('id'=>$_GPC['id']));
  8. if($info['imgs']){
  9. if(strpos($info['imgs'],',')){
  10. $imgs= explode(',',$info['imgs']);
  11. }else{
  12. $imgs=array(
  13. 0=>$info['imgs']
  14. );
  15. }
  16. }
  17. if($info['lb_imgs']){
  18. if(strpos($info['lb_imgs'],',')){
  19. $lb_imgs= explode(',',$info['lb_imgs']);
  20. }else{
  21. $lb_imgs=array(
  22. 0=>$info['lb_imgs']
  23. );
  24. }
  25. }
  26. if(checksubmit('submit')){
  27. if($_GPC['imgs']){
  28. $data['imgs']=implode(",",$_GPC['imgs']);
  29. }else{
  30. $data['imgs']='';
  31. }
  32. if($_GPC['lb_imgs']){
  33. $data['lb_imgs']=implode(",",$_GPC['lb_imgs']);
  34. }else{
  35. $data['lb_imgs']='';
  36. }
  37. $data['goods_name']=$_GPC['goods_name'];
  38. $data['goods_num']=$_GPC['goods_num'];
  39. $data['goods_cost']=$_GPC['goods_cost'];
  40. $data['freight']=$_GPC['freight'];
  41. $data['delivery']=$_GPC['delivery'];
  42. $data['quality']=$_GPC['quality'];
  43. $data['free']=$_GPC['free'];
  44. $data['all_day']=$_GPC['all_day'];
  45. $data['service']=$_GPC['service'];
  46. $data['refund']=$_GPC['refund'];
  47. $data['weeks']=$_GPC['weeks'];
  48. $data['store_id']=$storeid;
  49. $data['goods_details']=$_GPC['goods_details'];
  50. $data['time']=time();
  51. $data['uniacid']=$_W['uniacid'];
  52. if($_GPC['id']==''){
  53. if($sys['is_goods']==1){
  54. $data['state']=1;
  55. }
  56. if($sys['is_goods']==2){
  57. $data['state']=2;
  58. }
  59. $res = pdo_insert('zhtc_goods', $data);
  60. }else{
  61. $res = pdo_update('zhtc_goods', $data, array('id' => $_GPC['id']));
  62. }
  63. if($res){
  64. message('编辑成功',$this->createWebUrl2('sjgoods',array()),'success');
  65. }else{
  66. message('编辑失败','','error');
  67. }
  68. }
  69. include $this->template('web/sjaddgoods');