人人商城

module.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. class PaycenterModule extends WeModule {
  8. public $tablename = 'wxcard_reply';
  9. public $replies = array();
  10. public function fieldsFormDisplay($rid = 0) {
  11. if(!empty($rid)) {
  12. $replies = pdo_getall($this->tablename, array('rid' => $rid));
  13. }
  14. include $this->template('display');
  15. }
  16. public function fieldsFormValidate($rid = 0) {
  17. global $_GPC;
  18. $this->replies = @json_decode(htmlspecialchars_decode($_GPC['replies']), true);
  19. if(empty($this->replies)) {
  20. return '必须填写有效的回复内容.';
  21. }
  22. foreach($this->replies as $k => &$row) {
  23. if(empty($row['cid']) || empty($row['card_id'])) {
  24. unset($k);
  25. }
  26. }
  27. if(empty($this->replies)) {
  28. return '必须填写有效的回复内容.';
  29. }
  30. return '';
  31. }
  32. public function fieldsFormSubmit($rid = 0) {
  33. global $_GPC;
  34. pdo_delete($this->tablename, array('rid' => $rid));
  35. foreach($this->replies as $reply) {
  36. $data = array(
  37. 'rid' => $rid,
  38. 'title' => $reply['title'],
  39. 'card_id' => $reply['card_id'],
  40. 'cid' => $reply['cid'], 'brand_name' => $reply['brand_name'],
  41. 'logo_url' => $reply['logo_url'],
  42. 'success' => trim($_GPC['success']),
  43. 'error' => trim($_GPC['error'])
  44. );
  45. pdo_insert($this->tablename, $data);
  46. }
  47. return true;
  48. }
  49. public function ruleDeleted($rid = 0) {
  50. pdo_delete($this->tablename, array('rid' => $rid));
  51. return true;
  52. }
  53. }